Last post Jan 11, 2010 06:05 AM by HerryAtHotmail
Jan 09, 2010 04:55 PM|paysonwelch|LINK
I would like to get a reference to the PageHandler so that I can add new event handlers before the page loads / renders. The purpose will be to load my custom tracking module. The class that controls the tracking is stored in session for each user.
My experiments so far indicate that session is only available in an HTTPModule when I add an event listner to PostRequestHandlerExecute. However it would be ideal to be able to get to session before the page handler executes.
So is there a fairly easy way to get a reference to the page handler from PreRequestHandlerExecute, so that I can say something like:
Page.Load += new EventHandler(MyLoggingFunction)
Jan 11, 2010 06:05 AM|HerryAtHotmail|LINK
you can override OnInit Event of Page and can assign handler like:
protected override void OnInit(EventArgs e)
this.Load += new EventHandler(MyPage_Load);
protected void MyPage_Load(object sender, EventArgs e)
throw new NotImplementedException();