Coding: August 2007 Archives

I recently ran into a weird issue with ASP.NET. In my Global.asax file I have a handler for Application_Error to display a standard error page. However, in the Master Page (the handler transfers to an error page that inherits from a custom master page), I read the session state to show a global status.

This works fine, until an unhandled exception is thrown. Then I suddenly get an exception stating that Session is null. This made no sense, and I even discovered a response from someone on the internet that once an unhandled exception was thrown, the session state is reset (which is preposterous). Eventually I found the reason - the Application_Error event is raised *before* the AcquireRequestState event is raised - which sets up the Session state.

Simple conclusion - Session state is not available in Application_error.

About this Archive

This page is a archive of entries in the Coding category from August 2007.

Coding: June 2007 is the previous archive.

Coding: March 2008 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.12