This is Zhi-Qiang Ni from MSDN Managed Newsgroup support team, since I
have not seen your reply after I last posted my reply, I am writing to check
the status of this post. Please feel free to let me know if there is
anything else I can help. Thanks.
Based on my understanding, you are facing the issue that IIS7 seems to
ignore the ContentType property of a Response. However, based on my test,
it works well with both ContentType property value of
As you did not provide the complete code of this part in your page, it is
hard to say where the problem is. So I would like to share the code of my
test demo here. You may have a try with this code to see if this could help
to solve the case.
System.IO.FileInfo fi = new
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Response.ContentType = "application/vnd.ms-excel";
//Response.ContentType = "application/octet-stream";
Microsoft Online Support