Re: Global's non static methods

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: William F. Robertson, Jr. (wfrobertson_at_kpmg.com)
Date: 05/05/04


Date: Wed, 5 May 2004 12:51:33 -0500

You are both incorrect, you can instantiate an instance of Global.

(How else does asp.net work if it is impossible to instantiate an Global to
process each request?)

But the second part of Scott's reply is correct. I didn't even realize
there was an ApplicationInstance property of the Context.

Alan, Is there any reason you don't want the property to be static?

bill

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:1l7i90pspdmtkolkbtgj41httqcbfmb3lg@4ax.com...
> Hi Alan,
>
> On Wed, 5 May 2004 12:03:00 -0400, "A.M" <IHateSpam@sapm123.com>
> wrote:
>
>
> >I don't think we can create our own instance of Global object.
> >
>
> That's correct.
>
> >I am sure that ASP.NET framework creates the instance for us.
> >Based on what microsoft mentioned in kb#312607, I should be able to have
> >access to that instance by using Page.ApplicationInstance property, But
it
> >doesn't work for me. That means I don't have access to non-static
members!
> >and they don't appear in IDE inlisense
> >
>
> I think that is a bug in the documentation. It should probably read
> "every page includes a strongly-typed Context property of type
> "HttpContext". To get to the instance of the Global class associated
> with your request, you can do:
>
> Global g = Context.ApplicationInstance as Global;
> if(g != null)
> {
> // party on g
> }
>
> Hope that helps.
>
> --
> Scott
> http://www.OdeToCode.com
>
>



Relevant Pages

  • Re: ipnat ? Can not connect to 80 port under private address.
    ... Sorry, I requested incorrect syntax. ... Sorry I requested my colleague, but he do not execute my request. ... configuration is incorrect. ...
    (comp.unix.solaris)
  • Re: Merry Xmas to me!
    ... >>>You're lying again, Josh. ... >"If that's acceptable to you or Alan then tell me what you'll accept. ... The requested proof has to at least be feasible. ... request that's not feasible is not a request at all and therefore ...
    (comp.sys.mac.advocacy)
  • Re: apple bans sharing rejection letters to app store
    ... concept of dedicated reps to the thread, not Alan. ... Incorrect, I correctly pointed out that you didn't supply a quote from ... your claim as him suggesting that: ...
    (comp.sys.mac.advocacy)
  • Re: FireWire going the way of SCSI and ADB?
    ... > What a surprise that we find you yet again avoiding the request. ... What a surprise that you snipped part of the post to which you were ... Alan Baker ... "If you raise the ceiling 4 feet, move the fireplace from that wall ...
    (comp.sys.mac.advocacy)
  • Re: [PATCH] Correctly release and allocate a new request on TUR retries
    ... I/O request being re-used, without being re-initialized properly. ... Prior to this patch, boots were failing consistently as in: ... that before re-use? ... Thanks Alan, if do you that and confirm that it works with your hw ...
    (Linux-Kernel)