【发布时间】:2011-03-09 06:04:38
【问题描述】:
我一直在用
protected void Application_Error(Object sender, EventArgs e)
{
HttpException ex = Server.GetLastError() as HttpException;
Exception ex_T = ex;
Session["Ex"] = ex;
Session["Ex_T"] = ex_T;
Response.Redirect("~/errorPage.aspx" );
}
异常处理函数。
当我登录应用程序时“有时”
发生异常,详情如下
System.Web.HttpException was unhandled by user code
Message="Session state is not available in this context."
Source="System.Web"
ErrorCode=-2147467259
StackTrace:
at System.Web.HttpApplication.get_Session()
at Tools.Global.Application_Error(Object sender, EventArgs e) in C:\Myproject\Tools\Global.asax.cs:line 67
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.HttpApplication.RaiseOnError()
InnerException:
我无法追踪原因
谁能帮帮我
提前致谢
【问题讨论】:
-
"登录应用程序" 怎么样?您是否碰巧使用了未实现
IRequiresSessionState的IHttpHandler?