This session timeout thing has popped up again.
Is there a way to globally redirect the user to a timeout
page when the session variables have timed out?
I really don't want to add a check on each and every page
in the page_load that will check the session.
please advise...
I've tried to check the session variable in the global.asax
file in the
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
if session.Item("company_id") is nothing then
response.Redirect("logout.aspx")
End If
End Sub
but the session object is not allowed in this context
any ideas would be appreciated
thanks
tonyAn alternate method will be create a small function in one of the module and then just call the function at the top of each page.
Function Is_Session_Alive will return Flase is session has lost its values otherwise True
At the start of each page
If Is_Session_Alive(Session("Language"), Session("Service"), Session("Department")) = False Then
Response.Redirect("DefaultErrorPage.aspx")
End If
Thanks
Shafiq
make a class inheriting the page and code there.
subsiquently inherit new class on every page
hemant
0 comments:
Post a Comment