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.
resourcesysAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
resourcesysConnect With a Mentor Author Commented:
Thanks to everyone, unfortunately issue is still there.
0
 
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 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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

Has to be from within the session end method.
0
 
resourcesysAuthor Commented:
No acceptable solution provided
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.