Re: what is SERVER a member of?
- From: "Andy Fish" <ajfish@xxxxxxxxxxxxxxxx>
- Date: Wed, 17 Aug 2005 08:21:25 +0100
"darrel" <notreal@xxxxxxxxxxx> wrote in message
news:Ow7NFRpoFHA.2156@xxxxxxxxxxxxxxxxxxxxxxx
>> From what I can tell this will not help the OP as the MapPath method is
> not
>> static
>
> I'm not quite sure what you mean by that.
a static method of a class is one which you can invoke independently of
having an instance of that class - it's more like a global function. read up
on OO concepts if you're not clear on this.
>
> Specifically, I'm taking a virtual path:
>
> /documents/shared/ and mapping it to the actual server, be it my local one
> when testing or the live server when deploying.
>
so either of my proposed solutions should work for you
>
>> To reply to the original question. Server is an instance member of the
> Page
>> class
>
> Ah! Well, that explains it.
>
>> 2. Use HttpContext.Current.Server.MapPath(). Through a bit of trickery
>> (well, thread local storage) this can dig out the server object
>> associated
>> with the current request. N.B. If you call this function from a thread
> that
>> is not processing an HTTP request, it will barf at runtime.
>
> This may be a naive question, but aren't all ASP.net threads part of a
> HTTP
> request (ie, postbacks?)
yes (assuming the thread was created by asp.net to handle a request). I was
just making the point that if, for whatever reason, you call that function
from another thread (one you have started yourself or when including this
same utility function in a different application) it won't work
>
> -Darrel
>
>
.
- Follow-Ups:
- Re: what is SERVER a member of?
- From: darrel
- Re: what is SERVER a member of?
- References:
- what is SERVER a member of?
- From: darrel
- Re: what is SERVER a member of?
- From: Juan T. Llibre
- Re: what is SERVER a member of?
- From: Andy Fish
- Re: what is SERVER a member of?
- From: darrel
- what is SERVER a member of?
- Prev by Date: AJAX latest Tutorials
- Next by Date: RE: "Disappearing cookies": any change in ASP.NET 2.0?
- Previous by thread: Re: what is SERVER a member of?
- Next by thread: Re: what is SERVER a member of?
- Index(es):
Relevant Pages
|