Imran Akram's blog

Let's talk about life, technicalities, career opportunities, current affairs and a lot more!

How to configure SQL Server to use the SQL Server Session Management in ASP .NET?

Posted on | August 6, 2008 | No Comments

ASP.NET offers three session management solutions. They are:

  • InProcess,
  • StateServer (outProcess),
  • SQLServer (based on the database)

Today I spent about 3 hours just to get the configuration right for using this third type called SQLServer based Session State Management. I ended up configuring it on SQL Server 2000,

Well, in short this is what my command looked like:-

aspnet_regsql -ssadd -S <Database Server Name> -U <DB User Name> -P <DB User’s Password>
Curious about the switches used here:
Over the application end, you need to make the following changes in your web.config file.
<system.web>

<sessionState mode=SQLServer sqlConnectionString=Data Source=DATABASE_SERVER_NAME;Initial Catalog=aspState;Persist Security Info=True;User ID=DBUSER_NAME;Password=DB_PASSWORD; allowCustomSqlDatabase=true >

</

 

</system.web>

Its very important that you set the allowCustomSqlDatabase=true” coz you wont be able to get it running without this — atleast that’s what I’ve learnt in the last 3-4 hours.

Hope that helps,

Happy programming!

 

  • Share/Bookmark

Comments

Leave a Reply