Saturday, May 31, 2008

ASP.NET HttpModule and Session Variables

If you want to use session variables in HttpModule, you have to write your code in PreRequestHandlerExecute event. In addition, your class should also inherit IRequiresSessionState interface. If you write your code in BeginRequest event, and try to get or set a session variable, you will get System.NullReferenceException exception. More information can be found at http://forums.asp.net/p/1098574/1665773.aspx.

No comments: