2 , configuring the session in Web. config
Session configuration information in the Web. config file:
Copy the Code code as follows:
<sessionstate mode= "off| inproc| stateserver| SQL Server "
Cookieless= "True|false"
timeout= "Number of minutes"
Stateconnectionstring= "Tcpip=server:port"
sqlconnectionstring= "SQL connection string"
statenetworktimeout= "Number of seconds"
/>
mode sets where to store the session information:
-off is set to not use session function;
-inproc is set to store the session in the process, that is, the ASP storage mode, which is the default value;
The-stateserver is set to store the session in a separate state service;
The-sqlserver setting stores the session in SQL Server.
cookieless sets where the client's session information is stored:
-ture uses the cookieless mode, when the client's session information is no longer stored using a cookie, but instead is stored via a URL. For example, the URL is http://localhost/MyTestApplication/(ulqsek45heu3ic2a5zgdl245)/default.aspx
-false uses cookie mode, which is the default value.
Timeout sets the number of minutes after which the server automatically discards session information. The default is 20 minutes.
stateConnectionString sets the server name and port number used when the session information is stored in the State service, for example: "tcpip=127.0.0.1:42424". When the value of mode is StateServer Yes, this property is required. (42424 is the default port).
sqlConnectionString sets the connection string when connecting to SQL Server. For example "datasource=localhost;integrated security=sspi;initial catalog=northwind". This property is required when the value of mode is SQL Server.
stateNetworkTimeout settings when the session state is stored using StateServer mode, the TCP/IP connection to the server that stores the state information is disconnected after the number of seconds that the Web server is idle. The default value is 10 seconds.
Configuring the session in Webconfig