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.