Question : application_beginrequest

I want to check a session variable each time a new page is displayed. therefore I use

Sub Application_BeginRequest()
     If Request.ServerVariables("HTTP_HOST") <> Session("http_host").ToString Then
         startSession()
     End If
End Sub

but the session state is not available in this context. is there another way to do this?

thanks!

Answer : application_beginrequest

If you do all this in the Page_Init or Page_PreInit event on the page you should have all the information available to you, and it should still be early enough in the page life-cycle to make the type of changes I think you might want to make. If you create your own page base class, and then in web.config make all pages inherit that class you can write the code once and apply it to all pages.
Random Solutions  
 
programming4us programming4us