ASP. NET session timeout settings

Source: Internet
Author: User

The default Asp.net session time is set to 20 minutes. That is, after 20 minutes, the server automatically discards the session information.

When we are in Asp.netProgramWhen webconfig is enabled, the following section is displayed:Code:

Asp.net program code:

<Sessionstate

Mode = "inproc"

Stateconnectionstring = "TCPIP = 127.0.0.1: 42424"

Sqlconnectionstring = "Data Source = 127.0.0.1; trusted_connection = yes"

Cookieless = "false"

Timeout = "20"

/>

The code above is to configure how the application stores session information.

The timeout = "20" is the default time of the Asp.net session. You need to change the time and fill in different values here. The default unit is minute.

Sessionstate node attributes:

<Sessionstate mode = "off | inproc | StateServer | sqlserver"

Cookieless = "True | false"

Timeout = "number of minutes"

Stateconnectionstring = "TCPIP = server: Port"

Sqlconnectionstring = "SQL connection string"

Statenetworktimeout = "number of seconds"

/>

The required attribute is

Mode setting: Where to store session information

Off is set to not use the session Function
Freight expert
Inproc is set to store sessions in the process, which is the storage method in ASP. This is the default value.

StateServer is set to store sessions in independent State services.

Sqlserver settings store sessions in SQL Server

Optional attributes:

Cookieless sets where the session information of the client is stored

Ture uses cookieless Mode

False uses cookie mode, which is the default value.

Timeout specifies the number of minutes after which the server automatically waives the session information. The default value is 20 minutes.

Stateconnectionstring sets the server name and port number used by session information stored in the status service, for example, "TCPIP = 127.0.0.1: 42424 ". This attribute is required when the mode value is StateServer.

Sqlconnectionstring sets the connection string when connecting to SQL Server. This attribute is required when the mode value is sqlserver.

Statenetworktimeout sets the number of seconds after the session state is stored in StateServer mode and the TCP/IP connection between the Web server and the server that stores the status information. The default value is 10 seconds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.