In general, we like to use Session to store our variables. Asp. Net provides the following methods to store Session values:
InProc
State Server
SQL Server
"InProc" indicates that we store the Session value in the same way as traditional ASP, and "State Server" indicates that we use another host to store the Session value. Of course, we can also use SQL Server to store values. This article is dedicated to explaining this method.
Run the InstallSqlState. SQL File
Find the InstallSqlState. SQL file in WinntMicrosoft. Net and execute it in SQL Server. On my machine, it exists in the E: WINNTMicrosoft. NETFrameworkv1.0.2914 directory. This file is provided by Microsoft and contains a wide range of SQL statements, so you can use it with confidence. Is the generated data table.
Modify your web. config file and set the Session mode to SQL Server.
Change the sessionState section of web. config:
<SessionState mode = "SQLServer"
SqlConnectionString = "data source =
WIN2000; userid =
Sa; password = "cookieless =" false "timeout =
"20"/>
Create Asp. Net Web Forms
Next we will build a test ASP.net program. We don't need to talk about it here when we use the Session program. below is my program. This program simply stores a string of data in the Session, and then displays the data in the Label control.
Now all Session variables are stored in the data table, rather than in the memory. You can open the ASPStateTempSessions table to view the Session data.
Delete these databases and tables
If you don't like the data storage method, you can delete the tables and databases. Do not worry that such deletion will affect the database (because you are afraid to delete some data by mistake), because Microsoft also has to provide you with a delete SQL file named UnintallSQLState. SQL. It is placed in the Config directory of. Net like IntallSQLState. SQL.