Accessing Session variables in Application_OnError in the Global.asax file

Joined
Jul 17, 2006
Messages
3
Reaction score
0
Hello,

I have been struggling with this problem for a while now and cannot find a solution.

In application_onerror in the global.asax file I create an email which sends some information to a system administrator and then redirects to an error page. The email was to include some information that is stored in session variables. However when I access these variables as follows :

Code:
Dim ProjectID as string = System.Web.HttpContext.Current.Session("ProjectId").ToString()

I get the following error :
Code:
Object reference not set to an instance of an object.

Session.Count produces the same error, whilst accessing just the Session object itself does not.

I know that the session variables contain data as they are used throughout the application.

I read here that the session object is not available in the Application_OnAuthenticateRequest handler inside global.asax

Is this then also the case for application_onerror ?

thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top