Search code examples
c#asp.netvb.netsessionhttpmodule

HTTPmodule event (with session access) after page_load has been executed?


Question: I'm fiddling with sessions in asp.net in a http module.

The problem:

session("whatever") = "something" 

is set on page_load

I need an event in the http-module which is executed after page_load, and in which I have access to the session in System.Web.HttpContext.Current.Session

I was looking at this HTTPModule Event Execution Order? but I can only get the session in PostAcquireRequestState, which obviously comes before page_load...


Solution

  • Why not use the PostRequestHandlerExecute event? All of the Page events will happen during the handler execute phase. There's no application event that will be fired in between page events. You could of course also cast the handler to System.Web.UI.Page, and hook up to the LoadComplete event before it executes.

    Menno