Click here to Skip to main content
12,551,373 members (53,141 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
i have made login page.when i click on login ,session is generate.i have to store time of login using session.when i logout ,session will be timeout and time of logout also store using session.

how to check session is timeout and how to store time of login and logout?

i have to do this without javascript.
please help me...
Posted 6-Jan-13 19:05pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

One approach to do this would be to check for ASP.NET_SessionId in the request.
This neat article[^] explains this approach.

Another approach could be to handle void Session_End(object sender, EventArgs e) in the global.asax file.
Member 9511889 7-Jan-13 4:05am
how to use sessionId ?i hav check your artical but i can't understand..
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


If you have no other option rather than session then use the fallowing Code :

public enum SessionKeys:int

After Log In :
After LogOut

Now you can check the session key IsLoggedIn to know whether user is Logged in or not.

if Timeout happened then IsLoggedIn key would be null so your check should me not Null and Not False.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.161021.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100