HttpContext.Current.Handler
是指当前请求的HttpHandler,一般为Page对象 (网上找来的,saucer(思归) 回答的。)pages= HttpContext.Current.Handler as System.Web.UI.Page;我这里想问的是 除了 Page 对象还有可能是什么对象?
我现在在看 ProMesh 框架,
它里面有一段:
namespace Activa.ProMesh
{
public class HttpModule : IHttpModule
{
public void Init(HttpApplication context)
{
//恰好在 ASP.NET 开始执行事件处理程序
context.PreRequestHandlerExecute += PreRequestHandlerExecute;
} private void PreRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.Handler is PageHandler)
ProMeshHttpContext.CreatePageContext(HttpContext.Current);
else
ProMeshHttpContext.CreateSessionContext(HttpContext.Current); //好像除了Page 对象外还会有 session 对象。一共有多少种可能?
} public void Dispose()
{
}
}
}
是指当前请求的HttpHandler,一般为Page对象 (网上找来的,saucer(思归) 回答的。)pages= HttpContext.Current.Handler as System.Web.UI.Page;我这里想问的是 除了 Page 对象还有可能是什么对象?
我现在在看 ProMesh 框架,
它里面有一段:
namespace Activa.ProMesh
{
public class HttpModule : IHttpModule
{
public void Init(HttpApplication context)
{
//恰好在 ASP.NET 开始执行事件处理程序
context.PreRequestHandlerExecute += PreRequestHandlerExecute;
} private void PreRequestHandlerExecute(object sender, EventArgs e)
{
if (HttpContext.Current.Handler is PageHandler)
ProMeshHttpContext.CreatePageContext(HttpContext.Current);
else
ProMeshHttpContext.CreateSessionContext(HttpContext.Current); //好像除了Page 对象外还会有 session 对象。一共有多少种可能?
} public void Dispose()
{
}
}
}
我对这个问题的不理解,让我走进了误区,
你这个结果 让我回到了正途,
关键 还是 oo概念的模糊阿。 PageHandler : IHttpHandler
它实现了这个东西多问一句的是:
asp.net 这个模型中 有哪些是实现了 IHttpHandler
除了一般的 我们见到的 Page 这种,还有哪些?
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG里面的web.config
里面有 <httpHandlers></httpHandlers> 那里应该是全部所有asp.net 中所有可能