I need to know how to configure the .config to manage Session state in SQL Server
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
First you need to create a Session database. In order to do this:
- Look for the aspnet_regsql.exe
- Run this command aspnet_regsql.exe -S [ServerName] -E -ssadd -sstype p
Where ServerName is your server name.
This will create this database ASPState
Now the configuration on the web.config
Add this sentence over
<sessionState allowCustomSqlDatabase="false" mode="SQLServer" sqlCommandTimeout="7200" sqlConnectionString="Server=SERVERNAME;User ID=User;Password=Password;" timeout="120" />
sqlCommandTimeout=”7200″ = 2hours and timeout=”120″ = 2hours
If you need more options regarding aspnet_regsql you can take a look HERE
Method 2
<configuration>
<sessionstate
mode="stateserver"
cookieless="false"
timeout="20"
sqlconnectionstring="data source=127.0.0.1;user id=<user id>;password=<password>"
server="127.0.0.1"
port="42424"
/>
</configuration>
Additional options here: http://msdn.microsoft.com/en-us/library/ms972429.aspx
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0