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



Is the public director a level above the root? You may try creating a path
relative to the root for the mappath. If public is above the root, you could
then try:
Server.MapPath("../" & Request.ApplicationPath & "/public/MyFolder/")

Request.ApplicationPath will return the name for the virtual root so it
won't be pinned on the local directory as much. Are you sure thought that
it's the global.asax that's being created in the bin and not just the dll
for the Global.asax file?

A couple other things to keep in mind. If the sessionstate is not set to
inproc, then the on_end event is ignored. Also, not all functions are
available in the on_end event. It is mainly there to cleanup session
variables and not necessarily to perform other cleanup tasks. For example,
classic ASP developers often tried to run database operations in the on_end
event but database calls weren't allowed during on_end.


--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006



"teo" <teo@xxxxxxxxx> wrote in message
news:hgeon2h5lirsnhq2hhnbrs3ahutcg1gkk6@xxxxxxxxxx
I need to use the 'Server.MapPath' function
in the 'Session_End' event of the Global.asax file
(to reach a folder and the clean some temporary files up),

but it doesn't work:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Dim myPath As String = (Server.MapPath("../public/MyFolder/")
End Sub

Note:
when I precompile the app,
the Global.asax file will be inserted in the BIN folder
(and not in the usual root folder)
so it may be a further problem

Any idea?


.