Note that there are some explanatory texts on larger screens.

plurals
  1. POHowto enable passing full file names in the PATH_INFO part of the URL
    text
    copied!<p>Because of issues with the Content-Disposition header (character encoding, cross-browser support) I decided to give another way to dynamically serve files a try.</p> <p>Namely, I redirect the request to something like:</p> <pre><code>localhost/Download/Page.aspx/filename-without-extension </code></pre> <p>in order for the browser to pick up the file name at the end. I also supply the correct Content-Type header (as determined by my ripped off System.Web.MimeMapping class).</p> <p>Now, for ZIP files this actually works fine. The browser offers to save the file with the extension .zip. For all other file types I have tried (exe, pdf, doc), though, it won't suggest a file extension, which leaves the file unusable for most users.</p> <p><strong>I see only one option to get around this: I need to put the extension into the URL.</strong></p> <pre><code>localhost/Download/Page.aspx/filename.ext </code></pre> <p>But doing so leads to a 404 error or similar because the web server will now look for the file in the subdirectory Page.aspx which doesn't exist.</p> <p><strong>Is there any configuration directive that would enable me to change this behavior for a particular subdirectory?</strong></p> <p>The project is a standard ASP.NET 3.5 Website. I would prefer a solution that doesn't involve complicated configuration in the IIS Manager. The best solution for me would be a directive in the ASPX file itself though that is unlikely to exist because this is a routing issue on the application level. But a Web.Config setting in a location tag would be nice.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload