c# 为 IRequiresSessionState 实现 IHttpModule 或 IHttpHandler
您好,如何设置 http 处理程序以便可以操作 IRequiresSessionState?我需要更改何时可以访问会话状态。有一个 stackoverflow 问题这花了我 90% 的时间,我对 C# 还太陌生,不知道如何实际实现它并让它工作。如果你们中的一位专家能给我一个快速的 123,我将永远感激不已。
Hi how do I set up an http handler so I can manipulate IRequiresSessionState? I need to change when I can access session state. There is a stackoverflow question that takes me 90% of the way there, I am just too green in c# to know how to actually implement it and get it to work. If one of you experts could give me a quick 123 I would be eternally grateful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个答案中的代码似乎是一个相当完整的
HttpModule
实现,保证可以访问会话状态。您能否更具体地说明哪些功能不起作用或您还需要它做什么?The code in this answer seems to be a pretty complete implementation of a
HttpModule
that's guaranteed to have access to session state. Could you be more specific about what's not working or what else you need it do to?IRequiresSessionState 是一个标记接口。它没有任何成员。没有什么可以实施的。如果用它标记一个类,则该类可以访问会话。就是这么简单。
IRequiresSessionState is a marker interface. It doesn't have any members. There's nothing to implement. If you mark a class with it, the class has access to the Session. It's that simple.
此处是有关如何进行的分步说明使用此功能。
Here is a step by step explanation on how to use this functionality.