locked
about sessionstate RRS feed

  • Question

  • User-788967271 posted

    Hi all:

    In my aspx application I use variable session. Suddenly, if I ask for them before 20 minutes (the default) they don't exist. Other times, thet exist. Why is this bizarre situation? I supposed that, as I run my application using the server included in VS 2012, possibly it is a bug.

    I use VS 2012, sql server 2012, asp.net 4.5

    Thanks in advance

    Thursday, March 21, 2013 4:45 AM

Answers

  • User-460739707 posted

    HI,

              ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session.

    Session State is used to store state on the server for a specific user, and times out by default after 20 minutes of inactivity (but will stay on the server as long as the user keeps returning within the 20 minutes).

              Below is a sample config.web file used to configure the session state settings for an ASP.NET application:

    <configuration>
          <sessionstate
               mode="inproc"
               cookieless="false"
               timeout="20"
               sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>"
               server="127.0.0.1"
               port="42424"
          />
    </configuration>

              For further information you can access to:  http://msdn.microsoft.com/en-us/library/ms972429.aspx

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 22, 2013 2:49 AM

All replies

  • User-1360095595 posted

    Session has a timeout. After the timeout expires the values stored are cleared. That's one reason. 

    Thursday, March 21, 2013 5:05 AM
  • User220175380 posted

    Hi,

    By default Session has 20 mins timeout, you should check this, Below forum will tell you about session and application state FYR,

    http://forums.asp.net/t/983980.aspx/1

    Thursday, March 21, 2013 5:59 AM
  • User1291589676 posted

    Any web application or websites has session timeout limit. By default it was set as 20 in your web.config file. If you want to increase this value goto web.config file and edit this value to maximum.

    To learn more about sessions refer the below links,

    http://msdn.microsoft.com/en-us/library/ms178581(v=vs.100).aspx

    http://msdn.microsoft.com/en-us/library/ms972429.aspx

    Thursday, March 21, 2013 6:09 AM
  • User-460739707 posted

    HI,

              ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. HTTP is a stateless protocol. This means that a Web server treats each HTTP request for a page as an independent request. The server retains no knowledge of variable values that were used during previous requests. ASP.NET session state identifies requests from the same browser during a limited time window as a session, and provides a way to persist variable values for the duration of that session.

    Session State is used to store state on the server for a specific user, and times out by default after 20 minutes of inactivity (but will stay on the server as long as the user keeps returning within the 20 minutes).

              Below is a sample config.web file used to configure the session state settings for an ASP.NET application:

    <configuration>
          <sessionstate
               mode="inproc"
               cookieless="false"
               timeout="20"
               sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>"
               server="127.0.0.1"
               port="42424"
          />
    </configuration>

              For further information you can access to:  http://msdn.microsoft.com/en-us/library/ms972429.aspx

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 22, 2013 2:49 AM