Session variable gets cleared without any apparent reason

I have this piece of code:

var thisUser = Session["user"];
if (thisUser == null)
    LogFile.Log("Logging out");

I am trying to track down why sometimes when I play with the system for a few minutes and suddenly the user session variable gets null.

It happens randomly in different scenarios.

I do not set the Session["user"] to null at any point.

Session timeout is set to 20 minutes.

I do not call Session.Clear() at any point.

Any ideas\thoughts\things I should look at as to why is it may happening?

I am using Firefox if that to any help.

The system is built with

For more info please ask.

are you calling the same host? if the base URL is different the server will treat this as different users. for example:

http://localhost/path/to/resource and http://localhost:80/path/to/resource

both point to the same resource, but the requests are different and the session cookie will be different, or not present.

An easy way to test this is to launch your browser's developer toolbar and monitor the network traffic. compare the URLs to make sure they are the same base path and the same session cookie is passed in the request.

Q502982, I want to store values in the session variables and Session Object. Only Visible to You and DevExpress Support. Visible to All Session Variables are getting cleared after a postback I think the cause of the problem lies in this line: cookieless="false". I figureout that it is not because of Button event. Session variables retain their values. But when a minor change is done in the class file, session variables are cleared of where as the session is alive.

First of all this looks like C# and ASP.NET, not classic ASP. Now if you never clear the session yourself and the server (or the app pool) is never restarted, then the only way to lose the session is to clear the browser's cookies.

Mastering ColdFusion MX, If you know the specific session variable you want to delete, you would use The next two scenarios explain different approaches to ending a particular session. Warning Clearing all session variables with structClear() is not advised, This can cause problems if you try to set new session variables later in your templates. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more Session variable gets cleared without any apparent reason

Editing the web.config will recycle the app pool, which clears the session info.

Matlab: A Practical Introduction to Programming and Problem Solving, A Practical Introduction to Programming and Problem Solving Stormy Attaway their use can cause problems with some programs that interact with MATLAB, so they no longer exist n clear variablename clears out a particular variable n of a MATLAB session, variables could be created and then selectively cleared  How to clear a session variable Hi guys!How to clear a session variable,I am facing a problem.I have two textbox :Username and password ,but for that I am. I'll cover the following topics in the code samples below: RegisterClientScriptBlockPage, FormsAuthentication, DateTime, ASP.NET, and Application End Session.

Should session variables be avoided?, If the answer is "a previous value", you should not be using session variables. Load balancing and server restarts don't cause any session issues. concept of sessions just because we don't like a particular implementation. Yes you can get by to some extent without session variables, using query  I have a problem where all my Session variables seem to just disappear for no apparent reason. SessionState is enabled for the application with a 20 minute timeout. All code resides in the same project in the same subdirectory on the same server.

Session Variables getting clear before logout, I wanted to know why Session variables are getting cleared before If you refresh the page and you're not being redirect to login, it must br  For this reason, session variables are commonly used to store sensitive information such as the current user id and password. When the session ends, either from the user closing the browser or due to a time-out, the session variables are cleared. Saving and Accessing Session Variables

Session Variable, Storing session variables that are no longer valid in a log may be the solution file of a particular PHP server does not include activation of the session.​auto_start Then, we can use $sessionKey to get the right value out of the $_​COOKIE array: There's usually no reason to do this, though, other than to inform yourself of  This is just one example, but there are several variables of pages like this where the mysterious vanishing session occurs. Most of the time, everything works fine, but regularly, at inexplicable intervals, the user session vanishes, causing the validated login to fail, and the user is sent back to the login screen.

  • That is not classic asp. Does "playing with the system" include editing the web.config?
  • Do you host your application as multi worker processes?
  • @Jamiec Yea I edited the question, no, i didnt play with any of the project files..
  • @Khanh TO Its using IIS
  • but did you host in multi worker processes application pool?…
  • thats what i am trying to understand, because it suddenly happends randomally when you play with the system, I do not reset the browser cache