Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to store Session values in SQL Server

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to store the Session value in SQL Server, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

In general, we like to use Session to store our variables. Asp.Net provides the following methods for storing Session values: InProc StateServer SQL Server "InProc" means we store Session values in the same way as traditional ASP, and "StateServer" means we use another host to store Session values. Of course, we can also use SQL Server to store values, and this article is dedicated to explaining this approach. Running the InstallSqlState.sql file requires first finding the InstallSqlState.sql file in WinntMicrosoft. Net and then executing it in SQL Server. On my machine, it exists in the E: WINNT Microsoft. NET Framework v1.0.2914 directory. This file is provided by Microsoft itself, which has a very complete SQL statement, we feel free to use.

Modify your web.config file to specify Session mode as SQLServer and change the sessionState section of web.config to:

Create Asp. NetWebForms below to create a test ASP.NET program, using the Session program here need not say more, the following is a screenshot of my program. This program simply stores a string of data in a Session and then displays that data in a Label control. All Session variables are now stored in data tables, not memory. You can open the ASPStateTempSessions table to view this Session data. Delete these databases and tables If you don't like the way this data is stored and you really don't like it, then you can delete these tables and databases completely. Don't worry about this deletion affecting the database (for fear of accidentally deleting some data), because Microsoft will also have to provide you with a deletion SQL file called UnintallSQLState.sql. It is placed in the Config directory of. Net, as is IntallSQLState.sql.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report