Reputation: 1976
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="(wildcard)" path="(wildcard).txt"
I have a file called myunformated.txt, I would like IIS 6 to send it to the user if it doesn't have querystring params attached.
Any Ideas?
Upvotes: 0
Views: 1498
Reputation: 36037
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.
Upvotes: 1
Reputation: 189457
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.
Upvotes: 2