Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 21, 2013 09:34 AM by Ruchira
Jan 20, 2013 02:48 PM|LINK
I have a web page that works fine as long as the pc does not go into sleep mode. The page uses some session variables and if those session variables are not available on the load or postback the page redirects to the site's main page. Oddly enough the
page displays correctly when you come back from sleep mode, but as soon as you try to use any of the page functions the page gets redirected to the site's main page. The question I have is do you lose your session variables once the pc goes into sleep mode
and if so is there a work around? Is there anything else I should look at to diagnose the problem?
Jan 20, 2013 03:14 PM|LINK
I think your session is simple timed out. Increase the session timeout in the web.config.
Jan 20, 2013 03:54 PM|LINK
Besides Session, I think your problem is also related to Application Pool idle timeout. You can configure your app pool idl timeout by going through the steps mentioned in below link.
or you can even disable app pool with this link
Jan 20, 2013 04:23 PM|LINK
Session variables generally last only about 20 minutes or so after the last activity. When accessing session variables, I always use methods that enable me to make a call to check the session variable (such as an object with static properties) that I can
get/set the sessoin variables easily and handle things if the session variable is null.
Session variables are stored in memory, which makes them very volatile. Since memory is a valuable resource, the web server does whatever it can to ensure that memory is always available. This includes garbage collecting by way of destroying sessions once
the user has been inactive. On top of that though, IIS will release the application itself after a period of inactivity and then recompile and reload the app upon the next request.
Jan 20, 2013 07:06 PM|LINK
Thanks for the information. Would I be better using a cookie rather then a session variable in this case? Any advantage of one over the other?
Jan 21, 2013 09:34 AM|LINK
Would I be better using a cookie rather then a session variable in this case?
Cookies save information on client side (in browser) while sessions keep data in server side. So any information you save at the client side have the security risk of exposing to the end user. Also, cookies will be there until user clears it from the browser
while session will be there only for a particualar session (hence the name session).
Please 'Mark as Answer' if this post helps you.