void Pipeline_PostAuthorizeRequestStart(System.Web.IHttpModule sender, System.Web.HttpContext context) { if (HandlesRequest(context, c)) { //Communicate to the MVC plugin this request should not be affected by the UrlRoutingModule. context.Items[c.Pipeline.StopRoutingKey] = true; //Provide the request handler context.RemapHandler(new EndpointPluginPageHandler(ProcessRequest)); } }
void Pipeline_PostAuthorizeRequestStart(System.Web.IHttpModule sender, System.Web.HttpContext context) { if ((context.Request.FilePath.EndsWith("/resizer.debug", StringComparison.OrdinalIgnoreCase) || context.Request.FilePath.EndsWith("/resizer.debug.ashx", StringComparison.OrdinalIgnoreCase))) { //Communicate to the MVC plugin this request should not be affected by the UrlRoutingModule. context.Items[c.Pipeline.StopRoutingKey] = true; //Provide the request handler IHttpHandler handler = AllowResponse(context) ? (IHttpHandler) new DiagnosticPageHandler(c) : (IHttpHandler) new DiagnosticDisabledHandler(c); context.RemapHandler(handler); // The following line of code does nothing. I don't think there is any way to make this work before .NET 2.0 SP2 //context.Handler = handler; } }
public override void RemapHandler(IHttpHandler handler) { w.RemapHandler(handler); }
public void Process(System.Web.HttpContext current, IResponseArgs e) { current.RemapHandler(new Return304Handler(e)); }
public override void RemapHandler(IHttpHandler handler) { _context.RemapHandler(handler); }
private void Serve(HttpContext context, IResponseArgs e, MemCacheResult result) { context.RemapHandler(new MemCacheHandler(e,result.Data)); }
public void Process(HttpContext context, IResponseArgs e) { CacheResult r = Process(e); context.Items["FinalCachedFile"] = r.PhysicalPath; if (r.Data == null) { //Calculate the virtual path string virtualPath = VirtualCacheDir.TrimEnd('/') + '/' + r.RelativePath.Replace('\\', '/').TrimStart('/'); //Rewrite to cached, resized image. context.RewritePath(virtualPath, false); } else { //Remap the response args writer to use the existing stream. ((ResponseArgs)e).ResizeImageToStream = delegate(Stream s) { ((MemoryStream)r.Data).WriteTo(s); }; context.RemapHandler(new NoCacheHandler(e)); } }
private void TryRemapHandler(HttpContext context, IHttpHandler iHttpHandler) { try { context.RemapHandler(SlickUploadHandlerFactory.GetHandler(context)); } catch { // TODO: error somewhere? } }
private void ShowDebugInfo(HttpContext context, IHttpHandler handler) { if( s_IntegratedPipeline == false ) { handler.ProcessRequest(context); } else { bool isAfterMapRequestHandler = false; try { context.RemapHandler(handler); } catch( InvalidOperationException ) { // 在IIS7的集成管线模式下,当前阶段 >= MapRequestHandler 时,会引发这个异常 isAfterMapRequestHandler = true; } if( isAfterMapRequestHandler ) handler.ProcessRequest(context); } }