Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 29, 2012 10:44 PM by roopeshreddy
Feb 24, 2012 09:48 PM|LINK
HttpContext.Current.Session["name"] = CONTRACTS_CALL;
HttpContext.Current.Session.Timeout = 60 * 8;
Does this means that the session["name"] would be active for 480 minutes ?
Feb 24, 2012 10:16 PM|LINK
Yes. Of course, if the application is unloaded due to inactivity and the session is stored in memory it will be lost. Normally the application pool will recycle when the application hasn't been in use for a while, usually 20 minutes or more. This saves on
server resources such as memory and connections in the database connection pool and allows it to free up items that weren't properly handled in the garbage collection. Generally, don't could on session lasting for a long time and you should be prepared in
case the values come up null so your application doesn't crash, and you can possibly reload some of them without the user noticing any glitch.
Feb 25, 2012 08:53 AM|LINK
Yeah! Ususally no one keep 480 mins active sessions! max of 20-30 mins!
You can keep ur your value! There is no limitation!
Hope it helps u...
Feb 29, 2012 07:19 PM|LINK
So, can I say that I always check the session var if it is created or not before using it. like
if (Session["myVarName"] != null
.... then I can use it, this way, I will not have any error if the session object is not created.... Am I right
Feb 29, 2012 10:44 PM|LINK
Session will be created always! You are checking for the values stored in the session!
And yes, what you did is correct! you need to check for the NULL condition before using it! Good Practise!