Iron Speed Technical Forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
pkoutoul

Registered:
Posts: 293
Reply with quote  #1 
My app uses a lot of session variables. Everything works great in testing -- except when we let it go dormant for a while and allow the session to expire. Then we get weird results because the session variables have been lost. I have noticed that many apps on the Web redirect to a "session expired" page when this happens. Any ideas on how this is implemented? 


__________________
Pete Koutoulas • Fayette County Public Schools • Lexington, KY
echo4sos

Avatar / Picture

MVP Developer
Registered:
Posts: 172
Reply with quote  #2 
This may be of some help...

http://sjc.ironspeed.com/post/Session-Timeout-Popup-Reminder-4622896

__________________
-Bill
pkoutoul

Registered:
Posts: 293
Reply with quote  #3 
Thanks, Bill. I can certainly see where that would be useful. But in my case, I need something much simpler. I don't really care about providing advance warning, I just need a way to gracefully let them know that their session has expired. 

I was thinking I could check upon every page load to see if a particular session object exists (that I set upon login). If I were to do that, where could I put the code so that it works globally? 

__________________
Pete Koutoulas • Fayette County Public Schools • Lexington, KY
pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 968
Reply with quote  #4 

 

If you application has security enabled, they will auotmatically be redirected to the login page when the session expires.

 

 

 


__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
pkoutoul

Registered:
Posts: 293
Reply with quote  #5 
Thanks for that, Bryan. My app does use security but we currently do not require authentication for all parts of the app. But you got me to thinking, that may be the best way to solve this. 
__________________
Pete Koutoulas • Fayette County Public Schools • Lexington, KY
timt

Avatar / Picture

Iron Speed MVP
Registered:
Posts: 556
Reply with quote  #6 
Hi

You could also redirect away from the page using javascript. You would set the timeout to be 1 minute less than the session timeout (20 mins) and redirect to a page that forces the session to close Session.Abandon() and redirect back to the login page ie.

Prepare to be redirected!




HTH

__________________
Tim Titchmarsh Iron Speed Consultant MVP
London UK based
+44 (0)1621 835002
http://www.lightspeeditsolutions.co.uk/dotnetarchitect
timt@dotnetarchitect.co.uk
timt@lsits.co.uk
pkoutoul

Registered:
Posts: 293
Reply with quote  #7 
That is a very interesting approach, Tim! Don't know if I'll use it for this scenario but I am adding it to my back of tricks. 
__________________
Pete Koutoulas • Fayette County Public Schools • Lexington, KY
porphi

Registered:
Posts: 648
Reply with quote  #8 
Pete,

Here is another option.  Place the code below in the master page load event. Works without hardcoding the session time out and uses the IS sign out page referenced in the web.config file.  System wide also if placed in the master page file.

 

  Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) - 10) + "; URL=" + BaseClasses.Configuration.ApplicationSettings.Current.SignedOutPageUrl.ToString());




__________________
Thank you,
Phil Porter
PPG&A, INC.
pporter@ppgainc.com
http://www.ppgainc.com
https://rapidsprout.com
678-362-2035
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement