Select Categories Below
Quomon shares its advertising revenue with contributing experts that answer questions effectively. Join our community to share your knowledge and earn an income as you go.
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.
Advertisement
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
I would like to connect my wireless laptop to a printer which is connected to...
Microsoft OLE DB Provider for SQL Server error '80040e10'
Binding a dropdownlsit to a button to determine datagrid rows
Problem in the bluetooth of my Laptop
"windows needs to install bluetooth peripheral device" appears,although its i...
How do I trigger an event which was set up with dojo.connect?
You have 100 characters to use
Rank
Expert
Points
1.
738
2.
495
3.
450
4.
297
5.
215
6.
75
7.
50
8.
9.
10.
30
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 Real Estate Postcards Marketing Fulfillment