C# 404之后访问IHttpModule中的会话状态?

C# 404之后访问IHttpModule中的会话状态?,c#,asp.net,C#,Asp.net,是否可以在404之后的HttpModule的错误事件处理程序中访问SessionState 我正在尝试使用这篇博文中描述的技术为完整和部分回发实现一致的错误处理机制 我没有在查询字符串上传递参数,而是尝试将异常推送到会话状态,并从错误页访问它 SessionState在我运行服务器时永远不可用。HttpModule的错误处理程序中的传输不可用于错误页面 我尝试过将IHttpHandler重置为具有IRequestSessionState接口的IHttpHandler,但没有乐趣 提前感谢, 编辑

是否可以在404之后的HttpModule的错误事件处理程序中访问SessionState

我正在尝试使用这篇博文中描述的技术为完整和部分回发实现一致的错误处理机制

我没有在查询字符串上传递参数,而是尝试将异常推送到会话状态,并从错误页访问它

SessionState在我运行服务器时永远不可用。HttpModule的错误处理程序中的传输不可用于错误页面

我尝试过将IHttpHandler重置为具有IRequestSessionState接口的IHttpHandler,但没有乐趣

提前感谢,

编辑-IHttpModule错误处理程序的代码为

void context_Error(object sender, EventArgs e)
{
    try
    {            
        var srcPageUrl = HttpContext.Current.Request.Url.ToString();                       

        // If the error comes our handler we retrieve the query string
        if (srcPageUrl.Contains(NO_PAGE_STR))
        {
            // Deliberate 404 from page error handler so transfer to error page
            // SESSION NOT AVAILABLE !!!!

            HttpContext.Current.ClearError();                
            HttpContext.Current.Server.Transfer(string.Format("{0}?ErrorKey={1}", ERROR_PAGE_URL, errorKey), true);
        }
        else            
            HttpContext.Current.Server.ClearError();                

        return;
    }
    catch (Exception ex)
    {
        Logging.LogEvent(ex);
    }
} 
马特

这应该能奏效!为我工作

    public class ExceptionModule : IHttpModule
    {
        #region IHttpModule Members

        public void Dispose()
        {

        }

    /// <summary>
    /// Init method to register the event handlers for 
    /// the HttpApplication
    /// </summary>
    /// <param name="application">Http Application object</param>
    public void Init(HttpApplication application)
    {
        application.Error += this.Application_Error;
    }




    private void Application_Error(object sender, EventArgs e)
    {

                    // Create HttpApplication and HttpContext objects to access
                    // request and response properties.
                    var application = (HttpApplication)sender;
                    var context = application.Context;
                    application.Session["errorData"] = "yes there is an error";

                    context.Server.Transfer("Error.aspx");

         }
}