Wednesday, September 29, 2010

content-disposition filename should be quoted

When you want browser to open the document and give it a good name, you may use this code
Response.AddHeader("content-disposition","inline; filename=Internet User Report.pdf");

But it's not correct, you may see file name like Internet without .pdf

Why? Because the quotes are missing, according to W3C standard,
the code should be
Response.AddHeader("content-disposition","inline; filename=\"Internet User Report.pdf\"");

This problem is most obvious in Firefox.