Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Alternative to Response.Redirect on session end

Posted on 2011-03-03
8
Medium Priority
?
1,117 Views
Last Modified: 2012-06-27
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
Comment
Question by:resourcesys
  • 3
  • 3
  • 2
8 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 35025471
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
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 35025502
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
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 35025507
0
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 35025519
0
 

Author Comment

by:resourcesys
ID: 35025685
Cannot use forms authentication.

Has to be from within the session end method.
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 35025736
0
 

Accepted Solution

by:
resourcesys earned 0 total points
ID: 35187741
Thanks to everyone, unfortunately issue is still there.
0
 

Author Closing Comment

by:resourcesys
ID: 35225128
No acceptable solution provided
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question