We have been using the HTTPCompress module (BLowery), and when running your web site in development mode using the built-in web server in Visual Studio 2005 you can get the error "Server cannot append header after HTTP headers have been sent." in cases where you want to do a Response.Flush (e.g. for downloading a file to the client).
Now the HTTPCompress module can be configured to exclude certain pages by using the "excludedPaths" tag in the web.config file. But this did not seem to work.
The cause was this:
This is the line in the HTTPCompress Module that is supposed to chop off the absolute portion of the path:
string realPath = app.Request.Path.Remove(0, app.Request.ApplicationPath.Length+1);
This works fine if your web application is not at the root. But in the Visual Studio Development Web Server (formerly Cassini), the Request.ApplicationPath always comes back as "/". In that case the above code will actually chop off the first character of the relative path.
I.e. "/WebResource.axd" will become "ebResource.axd".
The Solution:
This is ugly, but when you do development using the Visual Studio built-in web server you need to add both paths to the web.config file.
<excludedPaths>
<add path="ebresource.axd"/>
<add path="WebResource.axd"/>
</excludedPaths>
Of course another option is to modify the HTTPCompress source code and fix this.
No comments:
Post a Comment