.net HttpHandlers Pass Request Up The Pipeline To IIS6

后端 未结 2 950
离开以前
离开以前 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.

    0 讨论(0)
  • 2021-01-28 21:04

    Why not just: Response.TransmitFile? - note that unlike Response.WriteFile this one won't load the whole file.

    You might want to avoid it entirely, and have the link point to a different filename. This way you get all the stuff you wanted from IIS - particularly resuming download.

    0 讨论(0)
提交回复
热议问题