如何在IHttpModule中处理Session? [英] How to handle Session in IHttpModule?
本文介绍了如何在IHttpModule中处理Session?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请参阅以下代码
Please see below code
public class URLRewriter : IHttpModule {
public void Dispose() {
}
public void Init( HttpApplication context ) {
context.BeginRequest += new EventHandler( context_BeginRequest );
}
void context_BeginRequest( object sender, EventArgs e ) {
//code to make custom URL
}
}
这里我使用IHttpModule进行自定义URL重定向。但是在目标页面中设置会话时显示错误。
ERROR LINE代码:HttpContext.Current.Session [USERADMIN] == null
错误消息:{System.NullReferenceException:对象引用未设置为对象的实例。
请帮助我。
谢谢
Here i am using IHttpModule for making custom URL redirection. But it showing error while setting session in destination page.
ERROR LINE Code : HttpContext.Current.Session[USERADMIN] == null
ERROR MEssage: "{System.NullReferenceException: Object reference not set to an instance of an object."
Please help me.
Thanks
推荐答案
检查这些以了解如何实现它。
我可以从HTTPModule访问会话状态吗? [ ^ ]
c#为IRequiresSessionState实现IHttpModule或IHttpHandler [ ^ ]
如何处理IHttpModule中的Session? [ ^ ]
Check these to see how to implement it..
Can I access session state from an HTTPModule?[^]
c# Implement IHttpModule or IHttpHandler for IRequiresSessionState[^]
How to handle Session in IHttpModule?[^]
这篇关于如何在IHttpModule中处理Session?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文