.net HttpHandlers Pass Request Up The Pipeline To IIS6

后端 未结 2 949
离开以前
离开以前 2021-01-28 20:04

Is there a way for a Http Handler to pass a request back up the pipeline to IIS 6 and let it handle the request?

For example, if I have a Http Handler set for verb=\"(wi

2条回答
  •  半阙折子戏
    2021-01-28 21:04

    The answer to your question is no. That's what the integrated pipeline of IIS7 acheives but its not available on IIS6.

    In this specific case using context.Response.TransmitFile will do the trick although you should consider setting the Response content type, charset and cache control headers, something like:-

    HttpResponse Response = context.Response
    
    Response.ContentType = "text/plain";
    Response.CharSet = "Windows-1252";
    Response.AddFileDependency(filePath);
    
    // Set additional properties to enable caching.
    Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
    Response.Cache.SetCacheability(HttpCacheability.Public);
    Response.Cache.SetValidUntilExpires(true);
    Response.TransmitFile(filePath);
    

    This pretty much duplicates what IIS static content handler would be doing.

提交回复
热议问题