开发者

Custom session state provider needed for DB storage?

I know this question is related to many others, but please bear with me.

I am trying an experiment to store all informat开发者_JAVA百科ion in database tables instead of the ASP.NET session. In ASP.NET 4 one can create a custom provider for session. So, again should I implement a Custom Session-State Provider or should I just disable session (in Web.config)?

Thanks!

From the comments my question can be misunderstood. Hopefully this tidbit will help clarify:

I don't want to store the session in the database. I want to store information in the database that you would typically store in the session. One reason why: I don't want to carry around a session on every page, especially if that page doesn't care about 90 percent of the information in the session


Instead of reinventing the wheel there is already a built-in SQL provider which you could use out of the box and which will store session data into SQL Server allowing for you application to better scale in web farm environments:

<sessionState
  mode="SQLServer"
  sqlConnectionString="data source=server;user id=uid;password=pwd"
  cookieless="false" timeout="20" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜