Re: [Global.asax] function Server.MapPath not available ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Session_OnEnd ( or Session_End ) does not support the Request, Response or Server objects.
The only built-in objects you can use are Session and Application.

So, instead of using a Server.MapPath directive in Session_End,
store the fully qualified path in an Application variable.

You'll have no problem using an Application variable
in Session _End, provided Session_End fires at all.

There's many circumstances in which Session_End does not fire.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"teo" <teo@xxxxxxxxx> wrote in message news:7rvrn2hnsi9pfb5a1rvjr9k2c8noce95rn@xxxxxxxxxx
Fortunately, in most cases, you can use a simple workaround.
Instead of calling the MapPath method, you can call the Context.MapPath method.
Or, instead of accessing the Page.Cache object, you can access the Context.Cache object.
I tried,

maybe I always adopted a wrong syntax,
but I always saw the blu irregular underline
under my syntax;

I tried:
Context.MapPath
HttpContext
HttpApplication
and several other namespaces,
but always got the blu irregular underline
(and the app never started)

Do you know the exact fully namespaced syntax?



.



Relevant Pages