Hi,
If you have no other option rather than session then use the fallowing Code :
public enum SessionKeys:int
{
Unknown=0,
LogInTime=1,
LogOutTime=2,
IsLoggedIn,3
}
After Log In :
Session[SessionKeys.LogInTime.ToString()]=DateTime.Now;
Session[SessionKeys.IsLoggedIn.ToString()]=true;
After LogOut
Session[SessionKeys.LogOutTime.ToString()]=DateTime.Now;
Session[SessionKeys.IsLoggedIn.ToString()]=false;
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.