Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

trapping asp.net session end

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dmalhotr@usa.net - 27 Mar 2008 20:34 GMT
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.

:D
Peter Bromberg [C# MVP] - 27 Mar 2008 21:00 GMT
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

> Hi,
>
[quoted text clipped - 7 lines]
>
> :D
Mark Rae [MVP] - 28 Mar 2008 03:14 GMT
> 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...

Signature

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

siccolo - 28 Mar 2008 15:21 GMT
On Mar 27, 3:34 pm, dmalh...@usa.net wrote:
> Hi,
>
[quoted text clipped - 7 lines]
>
> :D

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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.