[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1140
  • Last Modified:

Alternative to Response.Redirect on session end

Hi all,

I have the following code in a global.asax file:

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
    Response.Redirect("~/Relogin.htm")
End Sub


The problem is that when the session ends, the Response object seems to be null and so I am getting an error.

Does anyone have an alternative to this or is it possible to create a new response object.

Thanks.

resourcesys.
0
resourcesys
Asked:
resourcesys
  • 3
  • 3
  • 2
1 Solution
 
Pratima PharandeCommented:
Session_End is fired internally by the server, based on an internal timer. Thus, there is no HttpRequest associted when that happens. That is why Response.Redirect or Server.Transferdoes not make sense and will not work.
0
 
Pratima PharandeCommented:
Use forms authentication

<authentication mode="Forms">
        <forms name=".Login" loginUrl="LoginPage.aspx"
            protection="All" path="/" timeout="5" />
    </authentication>
.....

<sessionState mode="InProc" ... timeout="5"/>

this way whenever the session expires the form authentication too times out and when the user clicks on anything he will be redirected to login page..
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Dhanasekaran SengodanCommented:
0
 
resourcesysAuthor Commented:
Cannot use forms authentication.

Has to be from within the session end method.
0
 
resourcesysAuthor Commented:
Thanks to everyone, unfortunately issue is still there.
0
 
resourcesysAuthor Commented:
No acceptable solution provided
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now