May be this is a silly Question, How to check These two conditions ,
1.The session is not expired but , the session variable is not assigned any value.
2. Session variable is assigned with value, but session is expired.
if(Session["mykey"] != null)
{
// Session is not expired
}
else
{
// Session is expired
}
Will this condition work for above two scenarios, or do i have to handle this both differently.
Please Help.
Vishwas KadamannayaPosted Dec 2, 2013, 5:41 AM
Actually Session["mykey"] my session variable may or maynot be assigned any value, which depends on the code, so i only want to check the session expired or not.
How to do that, only to check the session expired or not, the above code will work fine if the session variable is assigned any value, if it is not assigned always i will get null, even if session not expired..
Please Help.
Tanuj KhuranaPosted Dec 2, 2013, 5:41 AM
Sanjeeb LenkaPosted Dec 2, 2013, 5:23 AM
Sanjay KumarPosted Dec 2, 2013, 5:23 AM
http://www.codeproject.com/Articles/32545/Exploring-Session-in-ASP-Net