在ASP.NET中实现自己的会话管理 [英] Implementing own Session Management in ASP.NET

查看:140
本文介绍了在ASP.NET中实现自己的会话管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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?

感谢您的帮助

关于迈克尔

推荐答案

您需要两件事,实现IHttpSessionState和HttpModule.在HttpModule中,可以挂接应用程序AcquireRequestState和ReleaseRequestState事件.

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

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

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

System.We.SessionState命名空间还有许多其他类,您可以根据需要在实现中使用它们,并且/或者可以将它们用作引用模式.

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.

这篇关于在ASP.NET中实现自己的会话管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆