Solved

Alternative to Response.Redirect on session end

Posted on 2011-03-03
8
1,087 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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