Solved

Sending a 'Session Timed Out' message to a user

Posted on 2010-08-27
6
837 Views
Last Modified: 2012-06-27
Hello,

I want to let my users know if their session has timed out. Can anyone tell me how to detect a timeout and how to redirect to a 'session_has_time_out.aspx' page that I've created.

Thanks.
0
Comment
Question by:tatton777
[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
6 Comments
 
LVL 18

Expert Comment

by:Anil Golamari
ID: 33543920
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 33543946
Here's the way I'm detecting timeout (pulled from an article @ 4guysfromrolla.com):

The AddHeader() call is adding a meta-refresh to the page sent back to the client, instructing the client browser to automatically refresh the page 3 seconde (in this example) after the session's timeout value. Note that I'm multiplying by 60 since the Timeout is in minutes and the meta values needs to be in seconds.
// Send header to refresh page 3 seconds after session times out
//   This should redirect the user to the timeout page
page.Response.AddHeader("Refresh", (page.Session.Timeout * 60 + 3).ToString());

if (page.Session["sessionobj"] == null)
{
    page.Server.Transfer(PageNames.PAGE_SESSION_EXP);
}

Open in new window

0
 
LVL 16

Accepted Solution

by:
SriVaddadi earned 500 total points
ID: 33545233
Here is a session time custom control

http://www.eggheadcafe.com/articles/20051228.asp
0
 
LVL 1

Author Comment

by:tatton777
ID: 33719950
Please leave the thread open a little longer as I now have enough time on my hands to try some of the suggestions that were given in this thread. With a little more time I can try the suggestions and then hopefully give someone some points.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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