global.asax : Application_Error and Session don't work

  • Thread starter Thread starter BenCoo
  • Start date Start date
B

BenCoo

In my ASP.NET 2.0 application I have in the global.asax.file the following
code

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
This dousn't work !!! Get error "Session state is not available in this
context."
Dim ex As Exception
ex = Server.GetLastError.InnerException
Session("Exception") = ex
Session("FilePath") = Server.MapPath(Me.ToString)
Response.Redirect("ErrorPage.aspx")
End Sub

I've get the error "Session state is not available in this context." when
there's an error on a page ...

Thanks for any help on this ...

Benny
 
Thanks, but didn't find a solution while the aspx-page where this error is
generated is in a subdirectory
 
Back
Top