SQL Server session configuration method

Source: Internet
Author: User
The following process is performed under Win 2003 sp2 + IIS 6.0, ASP. NET 2.0, and SQL Server 2005.

1. Install the session Database
To the framework directoryC: \ windows \ Microsoft. NET \ framework \ v2.0.50727

Run the following command:Aspnet_regsql.exe-ssadd-sstype c-d [dB]-s [server]-e

-E uses Windows authentication or database Authentication:Aspnet_regsql.exe-ssadd-sstype c-d [dB]-s [server]-U [user name]-P [Password]

Create a session database in the specified database of the specified SQL Server server. It can be a separate database, that is, it can beProgramIf you do not specify the database name, a default database name is used. After the account is created, grant the corresponding account permissions in SQL Server.

2. modify web. config: sessionstate mode =" sqlserver " allowcustomsqldatabase =" true " sqlconnectionstring =" Data Source = [server]; initial catalog = [dB]; user id = [user name]; password = [Password] "
cookieless =" false "
timeout =" 20 " />

If the default database name is used:<SessionstateMode= "Sqlserver"Sqlconnectionstring= "Data Source = [server]; user id = [user name]; Password = [Password]"
Cookieless= "False"
Timeout= "20" />

In this way, the session of the program will be stored in the database. One thing to note is that after this configuration, the objects stored in the session must be serializable. If it is a custom class, the [seriablizable] attribute must be added.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.