Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

ASP.NET Session States in SQLServer for multiuser and loadbalancing solution

0.00/5 (No votes)
4 Nov 2009 1  
This topic is for those who want to manage multi server websites and load balancing.Prerequisites:IIS 6.0 or higher.NET Framework 2.0,

This articles was originally at wiki.asp.net but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

This topic is for those who want to manage multi server websites and load balancing.

Prerequisites:

  • IIS 6.0 or higher
  • .NET Framework 2.0, 3.5
  • VS 2008, 2005
  • ASP.NET 2.0 or higher

How To in WinXP Professional?

  1. In SQL Server management consol
  2. Open file from path "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallPersistSqlState.sql"
  3. Execute this script file on master database
  4. Go to command prompt of windows (Start->Run->cmd)
  5. Type net stop w3svc
  6. press Enter key
  7. Type net start w3svc
  8. press Enter key
  9. type iisreset
  10. press Enter key
  11. type net start aspstate
  12. press Enter key
  13. type aspnet_regsql
  14. press Enter key
  15. follow the instruction (by default next, next) (specify database aspstate)
  16. Type net stop w3svc
  17. press Enter key
  18. Type net start w3svc
  19. press Enter key
  20. type iisreset
  21. press Enter key
  22. type net start aspstate
  23. press Enter key

------------------------

  • modify your web.config with following
 <sessionState mode="SQLServer" sqlConnectionString="data source=127.0.0.1; user id=<username>;password=<password>; "

cookieless="true"

timeout="20" />

  • (optional) modify your machine.config for all web servers with follwoing (dont user following, generate your new machine key)

<machineKey validationKey='A130E240DF1C49E2764EF8A86CEDCBB11274E5298A130CA08B90EED016C0

14CEAE1D86344C29E67E99DF83347E43820050A2B9C9FC89E0574BF3394B6D0401A9'

decryptionKey='2CC37FFA8D14925B9CBCC0E3B1506F35066FEF33FEB4ADC8' validation='SHA1'/>

 

 

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here