ASP Session State in a SQL database

0 comments

 

To install asp sql server session state get the dba to run this on the web server. This is useful when the host starts recycling the app pool every few minutes!

 

  1. Open a command prompt
  2. Move to: C:\Windows\Microsoft.NET\Framework\v2.0.50727\
  3. Run: aspnet_regsql -S dbserverNameOrIP -U dbusername  -P passwordhere -ssadd -sstype c -d dbname

                              

where dbname is either a new db for this purpose, or the client's db

 

You may need to run this using the sa username and password

 

If using a new database, then we don't use the sa username and password to access this database 

Create a user on the database called SessionSystem that has db_owner, db_datareader and db_datawriter permissions

 

Then add the following code to your web.config:

 

<sessionState

mode="SQLServer"

allowCustomSqlDatabase="true"

sqlConnectionString="Data Source=dbserverNameOrIP;Initial Catalog=dbname;User Id=dbusername;Password=passwordhere;"

cookieless="false"

timeout="20"/>

 

 

  

links: 

http://msdn.microsoft.com/en-us/library/ms178586.aspx

http://msdn.microsoft.com/en-us/library/ms229862(VS.80).aspx

 

 

 

 

SQL

Comments


Leave a Comment