【发布时间】:2013-08-22 13:16:50
【问题描述】:
请看下面的代码
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
URLhttpApplication.Context.Server.Transfer( CustomPath );
}
}
这里我使用IHttpModule 进行自定义 URL 重定向。但是在目标页面中设置会话时显示错误。
错误行代码:
HttpContext.Current.Session[USERADMIN] == null
错误信息:
System.NullReferenceException:对象引用未设置为 对象的实例。
【问题讨论】:
-
查看其他帖子:[1]:stackoverflow.com/questions/276355/…