Hello,
I've found that if I try to do a Server.MapPath() in the Session_End event,
it fails with an exception.
is this right? any simple way to work round it?
is there any documentation that says what you can actually do in these
global.asax routines? - I've found out that Context is set to null but it
doesn't say that in any documentation I've seen
AndySee
http://msdn.microsoft.com/library/d...esevntonend.asp
"You cannot call the Server.MapPath
method in the Session_OnEnd script. "
Juan T. Llibre
ASP.NET MVP
===========
"Andy Fish" <ajfish@.blueyonder.co.uk> wrote in message
news:%23usAj9L$EHA.2180@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I've found that if I try to do a Server.MapPath() in the Session_End
> event, it fails with an exception.
> is this right? any simple way to work round it?
> is there any documentation that says what you can actually do in these
> global.asax routines? - I've found out that Context is set to null but it
> doesn't say that in any documentation I've seen
> Andy
>
One way you could work around this is in Application_Start, get the
Server.MapPath result and stick it in an Application variable, then you can
refer to the app var during session on end. Make sure NOT to use a Session
variable, as these are all already gone by the time you get to Session_End.
HTH.
"Andy Fish" <ajfish@.blueyonder.co.uk> wrote in message
news:%23usAj9L$EHA.2180@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I've found that if I try to do a Server.MapPath() in the Session_End
> event, it fails with an exception.
> is this right? any simple way to work round it?
> is there any documentation that says what you can actually do in these
> global.asax routines? - I've found out that Context is set to null but it
> doesn't say that in any documentation I've seen
> Andy
>
Thanks Juan. This documentation is actually for asp rather than asp.net but
it seems the same rule applies. Typical how I managed to want the one call
that isn't available :-(
I guess maybe it needs to have a user context to map a path - I don't really
see why though
"Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
news:OMukcMM$EHA.2572@.tk2msftngp13.phx.gbl...
> See
> http://msdn.microsoft.com/library/d...esevntonend.asp
> "You cannot call the Server.MapPath
> method in the Session_OnEnd script. "
>
>
> Juan T. Llibre
> ASP.NET MVP
> ===========
> "Andy Fish" <ajfish@.blueyonder.co.uk> wrote in message
> news:%23usAj9L$EHA.2180@.TK2MSFTNGP10.phx.gbl...
>
Hi, Andy.
re:
> Thanks Juan.
You're very much welcome.
re:
>This documentation is actually for asp rather than asp.net but it seems the
>same rule applies.
Yes. The intrinsic objects behave the
same way in ASP as in ASP.NET.
There's some additional events in ASP.NET, and some nuances
regarding the way some of them behave but, basically, the way
the intrinsic objects are handled is the same.
Juan T. Llibre
ASP.NET MVP
===========
"Andy Fish" <ajfish@.blueyonder.co.uk> wrote in message
news:uBp5MAO$EHA.4028@.TK2MSFTNGP15.phx.gbl...
> Thanks Juan. This documentation is actually for asp rather than asp.net
> but it seems the same rule applies. Typical how I managed to want the one
> call that isn't available :-(
> I guess maybe it needs to have a user context to map a path - I don't
> really see why though
>
> "Juan T. Llibre" <nomailreplies@.nowhere.com> wrote in message
> news:OMukcMM$EHA.2572@.tk2msftngp13.phx.gbl...
Tuesday, March 13, 2012
Server.MapPath fails in Session_End event
Labels:
asp,
event,
exception,
fails,
mappath,
net,
server,
servermappath,
session_end
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment