Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > trapping asp.net session end

Reply
Thread Tools

trapping asp.net session end

 
 
DMH
Guest
Posts: n/a
 
      03-27-2008
Hi,

I would like to know if there was a way to trap a session timeout on
an asp.net event. What I mean is that I've set a session timeout in
the web.config file. What I would like to do is when that timeout is
reached, I would like it to fire an event. Is there some event in the
global asax that could fire when the session normally ends. I need to
capture this to call a corresponding function during time lapse
timeout.


 
Reply With Quote
 
 
 
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      03-27-2008
For InProc Session, the Session_End event in global.asax *is* the event that
is fired when a user Session has expired.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net


"" wrote:

> Hi,
>
> I would like to know if there was a way to trap a session timeout on
> an asp.net event. What I mean is that I've set a session timeout in
> the web.config file. What I would like to do is when that timeout is
> reached, I would like it to fire an event. Is there some event in the
> global asax that could fire when the session normally ends. I need to
> capture this to call a corresponding function during time lapse
> timeout.
>
>
>

 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      03-28-2008
<> wrote in message
news:836dfde5-aff7-4ea9-afdb-...

> I would like to know if there was a way to trap a session timeout on
> an ASP.NET event.


Session_End will fire when an inproc session terminates.

N.B. closing the browser or navigating to a different website will *NOT*
cause the session on the webserver to terminate...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
siccolo
Guest
Posts: n/a
 
      03-28-2008
> Hi,
>
> I would like to know if there was a way to trap a session timeout on
> an asp.net event. *What I mean is that I've set a session timeout in
> the web.config file. *What I would like to do is when that timeout is
> reached, I would like it to fire an event. *Is there some event in the
> global asax that could fire when the session normally ends. *I need to
> capture this to call a corresponding function during time lapse
> timeout.
>
>


or....if you have a session variable, let's call it "SessionTestVar",
then, you can do something like this:

<script language="javascript" type="text/javascript">
function ShowTimeoutWarning ()
{
window.alert( "Oh-ho!Session Expiring!" );
window.location.href = "your_start_page.aspx";
}
<%
if
( HttpContext.Current.Session["SessionTestVar"].ToString()!=null )
{

Response.Write( "setTimeout('ShowTimeoutWarning();', " +
( Session.Timeout *
60000 ).ToString() + " );" );
}
else
{
Response.Redirect("your_start_page.aspx", true);
}
%>



... more at http://www.siccolo.com/articles.asp
 

Last edited by Ian; 03-01-2009 at 11:00 AM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP! - Session Start, Session End Dan Colgan ASP .Net 2 09-04-2007 03:12 PM
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
Tomcat JSP session beans not being removed at the end of the session John Smith Java 2 07-15-2004 12:46 PM
Session end event is firing immediately after session start Ram ASP .Net 0 05-19-2004 08:22 AM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57