Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Closed Points: 100 Time: 01:57 - Jan 11, 2007
david
Hi, I need to check if the session has ended in asp.net 2 and write a message accordingly to the user to do that. Is there inbuilt functionality to do that, or will I have to implement something like leaving a cookie on the users machine to identify him as a recent visitor and then checking if the session is set or not? Or any other options?
Categories:
Add Categories
When adding more than one category, separate them with commas.
rcastagna
Date:: Jan 11, 2007
Time:: 10:04
David, There's a couple ways you can handle this one. .NET 2.0 makes it very easy if you have the person "log in" to the system. HttpContext.Current.User.IsAuthenticated with evaluate "true" if they have been authenticated and have not timed out. Once they timeout, they'll be taken to the login page before being able to proceed. Unfortunately, all info that may be associated with that session would probably be lost. I've also done a cookie in the past where I set the SessionID (you can also put this in a session variable if you want) and then when they "come back" to the server, check to see if the Session.SessionID currently on the server matches what's stored in the Cookie/Session Variable. If it is, they're still "OK"...if not, I send them to a function that clears out what's been set and redirects them to the "start over" page. This solution relies on the session timeout settings for the website, so if you want to handle it programmatically, you'll probably want to look at a client-side Javascript solution, which is how I accomplished the scenario below: If you want to alert the visitor that their session is about to timeout, it's more difficult. I've put together a javascript timer using the javascript setTimeout() function that after x minutes/seconds/hours an alert is popped up warning them they're about to expire. If they reach the end of the timer period, I do a javascript redirect to the login page. setTimeout is the Javascript function to research. I hope this helps get you on track. Ric
Date:: Jan 27, 2007
Time:: 07:23
Ric, thank you for the info about the IsAuthenticated boolean, I didn't know about that. I have chosen the cookie way, but don't need to tell the user that the session is about to expire. So handling it on the server is fine. And the points go to.... rcastagna.
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software