Response.Redirect from Application_Error - session changes lost

J

Jon Paugh

Hi,

So in Application_Error method in Global class of my
ASP.NET web project, I add:

HttpContext.Current.Session["SomeSessionThing"]
= "SomeSessionThing";

Then, in Application_Error method I Response.Redirect to
a error page. In the page's load, I check the value of

HttpContext.Current.Session["SomeSessionThing"]

and it now returns null.

What is going on here? I thought session would always be
preserved no matter what? I am using out of proc session
option.

Thanks,

Jon
 
J

Jon Paugh

Ok, I get to answer my own question. Are you ready? The
super secret technique for persisting session in
Application_Error,:

just call

Server.ClearError();
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top