I've got a C# page that's generating a PDF file and returning it to the user. I'm explicitly setting the Content-Type header to "application/pdf" and the MIME Type is registered in IIS, yet IIS seems to be stripping off the Content-Type.
The file is being returned correctly and if I choose to save it to disk I can open it just fine. If I run the page from the ASP.NET Development Server the Content-Type header comes through just fine.
The code...
byte[] pdf = //magic!
string filename = "Some.pdf";
Response.Clear();
Response.ClearHeaders();
//This way didn't work either...
//Response.ContentType = "application/pdf";
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename + ";size=" + pdf.Length.ToString());
Response.Flush();
Response.BinaryWrite(pdf);
Response.Flush();
Response.End();