Server.Transfer("somepage.aspx") from within Session_End
-
Hi, trying to: (Global.asax.vb) Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) Server.Transfer("somepage.aspx") Return End Sub No exception, but the redirection didn't work. Any idea? Thanks in advance. Norman Fung
-
Hi, trying to: (Global.asax.vb) Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) Server.Transfer("somepage.aspx") Return End Sub No exception, but the redirection didn't work. Any idea? Thanks in advance. Norman Fung
norm wrote: No exception, but the redirection didn't work. Any idea? Not really. What are you actually trying to achieve? By that, I mean at a higher level, not this particular task - I get the feeling that you have gone down the wrong road somewhere and you are stuck on that track. It might be better to back up slightly and re-examine the overall problem.
Do you want to know more? WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
-
This is not possible. Session_End fires (standard) 30 minutes after the user made his last action on the website. It is not possible to transfer your user to a page when he leaves the site. (Not with asp.net anyway, maybe with javascript or something)
-
So anyone knows how to do it? I mean redirect to a page when session expires. Thanks a bunch.
When the user makes a new request after a session has ended the ASP.NET server will start a new session. If there is a way to detect that the page they are trying to access is invalid for the first page request in a session you can redirect them at the session start. If you need to automatically log the user out after a set amount of time you need to write some javascript to do that. The javascript can then redirect the user to the page. However, some people turn javascript off, so you cannot rely on that completely.
Do you want to know more? WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums