global.asax session help
-
Hi i have a logging session which i use in the global.asax file which determines if the user is authenticated to the system i ahve it working within reason but if i try to access a page before logging in it will render page then will write my relogin page to the same page I want it to redirect to this page relogin page if the user isn't authenticated on the system, so that nothing is showing by the browser i have the following code
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
Session("loggedin") = "False"
CheckLoggedIn()
Session.Timeout = 20End Sub Sub Application\_OnPostRequestHandlerExecute() CheckLoggedIn() End Sub 'Check that the user is logged in. Sub CheckLoggedIn() 'If the user is not logged in and you are not currently on the Login Page. If InStr(Request.RawUrl, "default.aspx") Or InStr(Request.RawUrl, "passwordrecover") And Session("loggedin") = "null" Then ElseIf Session("Loggedin") = "False" Then server.transfer("relogin.aspx") ElseIf Session("Loggedin") = "True" Then End If End Sub Sub Session\_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a session ends. ' Note: The Session\_End event is raised only when the sessionstate mode ' is set to InProc in the Web.config file. If session mode is set to StateServer ' or SQLServer, the event is not raised. Server.Transfer("relogin.aspx") End Sub
I have also tryed using response.redirect, but this jus does the same in thing IE, and firefox will jus timeout everytime any help appreciated boyindie
-
Hi i have a logging session which i use in the global.asax file which determines if the user is authenticated to the system i ahve it working within reason but if i try to access a page before logging in it will render page then will write my relogin page to the same page I want it to redirect to this page relogin page if the user isn't authenticated on the system, so that nothing is showing by the browser i have the following code
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
Session("loggedin") = "False"
CheckLoggedIn()
Session.Timeout = 20End Sub Sub Application\_OnPostRequestHandlerExecute() CheckLoggedIn() End Sub 'Check that the user is logged in. Sub CheckLoggedIn() 'If the user is not logged in and you are not currently on the Login Page. If InStr(Request.RawUrl, "default.aspx") Or InStr(Request.RawUrl, "passwordrecover") And Session("loggedin") = "null" Then ElseIf Session("Loggedin") = "False" Then server.transfer("relogin.aspx") ElseIf Session("Loggedin") = "True" Then End If End Sub Sub Session\_End(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a session ends. ' Note: The Session\_End event is raised only when the sessionstate mode ' is set to InProc in the Web.config file. If session mode is set to StateServer ' or SQLServer, the event is not raised. Server.Transfer("relogin.aspx") End Sub
I have also tryed using response.redirect, but this jus does the same in thing IE, and firefox will jus timeout everytime any help appreciated boyindie
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started just remove Session("loggedin") = "False" then try else just set Session("loggedin") = Null CheckLoggedIn() Session.Timeout = 20 End Sub saniya khengar v
-
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started just remove Session("loggedin") = "False" then try else just set Session("loggedin") = Null CheckLoggedIn() Session.Timeout = 20 End Sub saniya khengar v