After we moved to from IIS6 to IIS7 we are not able to run our appliaction. We have a HttpHandler generated by PageParser.GetCompiledPageInstance mehod, but Session is null while generating the page. Here is code example:
namespace Test
{
public class HttpHandlerWithSession : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
IHttpHandler handler;
public HttpHandlerWithSession(IHttpHandler _handler)
{
handler = _handler;
}
public bool IsReusable { get { return handler.IsReusable; } }
public void ProcessRequest(HttpContext context)
{
handler.ProcessRequest(context); // here context.Session is null
// as well in login.aspx.cs in Page_Load method
//HttpContext.Current.Session is null
// WHY???
}
}
public class PathRewriter : IHttpHandlerFactory
{
public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
return new HttpHandlerWithSession(PageParser.GetCompiledPageInstance("~/login.aspx", context.Server.MapPath("~/login.aspx"), context));
}
public void ReleaseHandler(IHttpHandler handler)
{ }
}
}
Does anybody know what is wrong? Thx
namespace Test
{
public class HttpHandlerWithSession : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
IHttpHandler handler;
public HttpHandlerWithSession(IHttpHandler _handler)
{
handler = _handler;
}
public bool IsReusable { get { return handler.IsReusable; } }
public void ProcessRequest(HttpContext context)
{
handler.ProcessRequest(context); // here context.Session is null
// as well in login.aspx.cs in Page_Load method
//HttpContext.Current.Session is null
// WHY???
}
}
public class PathRewriter : IHttpHandlerFactory
{
public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
{
return new HttpHandlerWithSession(PageParser.GetCompiledPageInstance("~/login.aspx", context.Server.MapPath("~/login.aspx"), context));
}
public void ReleaseHandler(IHttpHandler handler)
{ }
}
}
Does anybody know what is wrong? Thx