Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session_OnEnd

Reply
Thread Tools

Session_OnEnd

 
 
BillGatesFan
Guest
Posts: n/a
 
      02-22-2005
Is there a way to warn the user that there Session is about to end? I'm
using Forms authentication and when there session ends it takes them
back to the login screen like it is designed to do.


Also it there anyway to make it take the user to a different page once
the session ends?


Thanks

 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      02-22-2005
Hi BillGatesFan,

> Is there a way to warn the user that there Session is about to end?


Yes. You would have to know the Session Timeout, and add a JavaScript to
each page that uses the JavaScript setTimeout() function to execute a
JavaScript function shortly before the timeout.

> Also it there anyway to make it take the user to a different page once
> the session ends?


The user may be out playing basketball by the time the Session ends. (IOW,
no)

Let me explain: Session timeout occurs when NO REQUESTS have been made for a
period of (usually) 20 minutes. Without a Request, how can there be a
response?

However, using the technique I described above, you could do a client-side
redirect just prior to the Session timeout. Of course, keep in mind that the
new Request will reset the timeout, and the Session will not end, unless you
call Session.Abandon on the target page.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"BillGatesFan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Is there a way to warn the user that there Session is about to end? I'm
> using Forms authentication and when there session ends it takes them
> back to the login screen like it is designed to do.
>
>
> Also it there anyway to make it take the user to a different page once
> the session ends?
>
>
> Thanks
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmlzaG51LUNoaXZ1a3VsYQ==?=
Guest
Posts: n/a
 
      02-22-2005
Hi BillGatesFan,

Have a client side script using window.setInterval() method to fire a yes/no
window to fire near the session end time..

SetInterval: Evaluates an expression each time a specified number of
milliseconds has elapsed..
Check this link for more information..
http://msdn.microsoft.com/workshop/a...etinterval.asp

Once the session times out either you can refresh the page and check on the
post back and redirect him to login page or alert him...

Hope this helps..

Need any help, do post a msg back

Happy Coding

"BillGatesFan" wrote:

> Is there a way to warn the user that there Session is about to end? I'm
> using Forms authentication and when there session ends it takes them
> back to the login screen like it is designed to do.
>
>
> Also it there anyway to make it take the user to a different page once
> the session ends?
>
>
> Thanks
>
>

 
Reply With Quote
 
Michael
Guest
Posts: n/a
 
      02-22-2005
Add this to every page_load that you want the redirect on timeout to happen

Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) +
10) & ";URL=timeout.aspx")

This will redirect to a page after a specified interval in seconds.

You could also use this method to redirect to a warning page by changing the
'+10' to a '-30', checking that the result is > 0, and the url to your
warning page. In page load of your warning page, set the refresh to redirect
to your login page or some sort of message page when the timeout actually
occurs.

HTH..


"BillGatesFan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Is there a way to warn the user that there Session is about to end? I'm
> using Forms authentication and when there session ends it takes them
> back to the login screen like it is designed to do.
>
>
> Also it there anyway to make it take the user to a different page once
> the session ends?
>
>
> Thanks
>



 
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
HttpApplication inaccessible in Session_OnEnd:System.NullReferenceException Manfred Braun ASP .Net 3 08-30-2003 10:29 PM
session_onend event not firing rob ASP .Net 6 08-28-2003 09:43 AM
Session_OnEnd not fired in SQL Server mode steve ASP .Net 0 08-25-2003 12:53 AM
Session variables and Session_OnEnd Hans Kesting ASP .Net 4 08-19-2003 09:48 AM
my session_onend is not working anand ASP .Net 4 07-22-2003 04:47 AM



Advertisments