I have problem with configuration for IIS 6.0. I have a server which is used for download purpose, but for all files I would like to add custom header by a module:
private void Application_EndRequest(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
String filePath = application.Request.Path;
String fileName = VirtualPathUtility.GetFileName(filePath);
application.Response.AddHeader("Content-Disposition", String.Concat("attachment; filename=\"", fileName, "\""));
}
My problem is that when I try to do that for .exe file it doesn't work. I tried adding under mapping an extension to .exe -> c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll but that only forces to execute the .exe file on server.
I tried also with different execution permissions but setting anything other than Scripts and Executables resturns: HTTP Error 403.1 - Forbidden: Execute access is denied.
Any idea how to force that module to work with .exe files?
Does it allow you to download .exe file without your module?
Refer to http://blogs.msdn.com/b/david.wang/archive/2005/07/11/allow-file-downloads-on-iis-6.aspx