在 ASP.NET 中实现自己的会话管理

发布于 2024-07-27 17:20:13 字数 171 浏览 3 评论 0原文

在 ASP.NET 中实现自己的会话管理有哪些选项?

我刚刚找到了一种关于“劫持”内置会话管理的旧解决方案。

有没有一种好方法来实现执行所有会话任务的组件? 我如何包含一个在一个请求过程中接收 HTTP 请求和响应的类?

感谢您的帮助

问候迈克尔

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

〗斷ホ乔殘χμё〖 2024-08-03 17:20:13

您需要两件事,实现 IHttpSessionState 和 HttpModule。 在 HttpModule 中,您挂钩应用程序 AcquireRequestState 和 ReleaseRequestState 事件。

在 Web.Config 中,您需要删除默认会话模块并包含您自己的会话模块。

System.We.SessionState 命名空间有许多其他类,如果您愿意,可以在实现中使用它们和/或可以将其用作参考模式。

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.

软的没边 2024-08-03 17:20:13

查看这篇文章 @ MSDN
请注意,SQL Server 和会话状态服务提供程序是内置在 ASP.NET 中的,因此如果这对您来说足够了 - 您可以尝试其中之一...

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文