人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

August 24, 2006

Using SQL server to store asp.net session

Filed under: ASP.NET

1.运行%windir%\Microsoft.NET\Framework\version\InstallPersistSqlState.sql
It will create a database named “ASPState”

We should config the permission for asp.net process in this database.

2. Modify the web.config
<system.web>
<sessionState mode=”SQLServer” sqlConnectionString=”data source=servername;user id=uid;password=pwd” cookieless=”false”
timeout=”30″ stateNetworkTimeout=”20″/>
</system.web>

stateNetworkTimeout configuration setting is used to define the time, in seconds, that the ASP.NET Web
application will wait for the state server to respond to network requests.
By default, this time is 10 seconds.

3. If we using two IIS server or more, we need setup the same machine key in the web.config on those IIS
Sample:
<system.web>
<machineKey validation=”SHA1″ validationKey=”
F3690E7A3143C185AB1089616A8B4D81FD55DD7A69EEAA3B32A6AE813ECEECD28DEA66A
23BEE42193729BD48595EBAFE2C2E765BE77E006330BC3B1392D7C73F” />
</system.web>

! How to create a machine key
http://support.microsoft.com/?id=312906

4.所有要放入session的class必须Serializable,且尽量小.

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/08/24/using-sql-server-to-store-aspnet-session/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham