Because the access mechanism of the session in ASP is the same as ASP, it is kept in progress,
Once the process crashes, all session information will be lost, so I have taken the session information to SQL Server, although there are other
Several ways (not described in this article), to save the session to SQL Server, you need the following steps:
1. First to create a database to hold session data, in the form of a command line with Aspnet_regsql.exe to complete, the specific command is
C:\windows\microsoft.net\framework\v2.0.50727>aspnet_regsql.exe-ssadd-sstype C
-D sd-e
This command is the Windows authentication method, the SD database is added to save the session data.
2. You need to modify the sessionstate node in the ASP. Net. config file, which is located at <system.web>
<sessionstate mode= "SQL Server" allowcustomsqldatabase= "true"
Sqlconnectionstring= "server=.; Uid=sa;password=;initial CATALOG=SD "
Cookieless= "false"
Timeout= ">"
</sessionState>
In this way, the session data is no longer dependent on the IIS process but is saved to the database. You can open the SD database with two tables, aspstatetempsessions, Aspstatetempapplications, respectively.
Asp. NET to save the session to the database