Implementing own Session Management in ASP.NET

邮差的信 提交于 2019-12-22 00:14:38

问题


What options are there to implement an own session management in ASP.NET?

I just found one older solution about "highjacking" the built-in session management.

Is there a nice way to implement a component which performs all session tasks? How can i include a class which receives the HTTP Request and Response during one request process?

Thanks for your help

Regards Michael


回答1:


You need two things, implement the IHttpSessionState and a HttpModule. In the HttpModule you hook the applications AcquireRequestState and ReleaseRequestState events.

In the Web.Config you need to remove the default session module and include your own.

The System.We.SessionState namespace has a number of other classes that you can uses in your implementation if you desire and/or you can use for a reference pattern.




回答2:


Check out this article @ MSDN. Please note, that SQL Server and Session State Service providers are built-in in ASP.NET, so if it is enough for you - you can try out one of these...



来源:https://stackoverflow.com/questions/1142010/implementing-own-session-management-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!