mode="SQLServer" for sessionState
When you choose your sessionState to be SQLServer, ASP.Net uses the default DB and initial catalogs for storing your session information into SQLServer... That is the reason you are not allowed to pass tokens such as Database and Initial Catalog in the connection string... Finally your entry in the web.config file will look like
<configuration> <system.web> <sessionState mode="SQLServer" sqlConnectionString="server=127.0.0.1;uid=<user id>;pwd<password>" /> </system.web> </configuration>
user id and password can be replaced by integrated security settings... Mitesh Mehta Microsoft Certified Professional
|
2 comments:
Well this time we will get into little details... ASP.Net provides two pair
of SQL scripts to create/delete the SQLServer Session DB... The first pair
of script creates TempDB where ASP.Net session state is stored, but as the
name specifies this DB will loose its value if SQL server is
re-started...the script are named InstallSqlState.sql and
UninstallSqlState.sql...
If you wish to keep your session data even more secure, you would do so by
running the other pair of scripts... These scripts create permanent tables
on SQL Server... These scripts are called InstallPersistSqlState.sql and
UninstallPersistSqlState.sql...
All the above mentioned scripts are located in the same folder as the
session state NT service...
SQL Server Session State Does It Again
Well did you wonder yesterday, that if your session data was stored in
permanent tables on SQL server and there would be "n" number of sessions
running for your application all the time how much data would get collected
in the SQL Server???... If you thought about it, I really appreciate...
So, there has to be a mechanism to clean this data every once in a while
right!!... And of course there is... When SQL Server support for session
gets installed a job to delete the expired session is also installed, this
job runs every minute and is called ASPState_Job_DeleteExpiredSessions...;
It requires SQLServerAgent service to be running in order to work...
Mitesh Mehta
Microsoft Certified Professional
Post a Comment