Hello all,
I have an ASP.NET application that allows users to download excel files. The code used is the following:
The problem is that when the download window comes up, and the user chooses to Open the file, the download window appears again, and the user is forced to make his choice again. After choosing Open twice, the file opens in Excel.
Note: If the user selects Save, the download window does not reappear.
I have the exact same code running for pdf files. The only difference in the code is that the ContentType is "application/pdf" as opposed to "application/ms-excel". With the pdfs, though, I don't experience this problem.
Does anybody know why the download window opens twice?
Thanks.
JC
_________________________________
I think, therefore I am. [Rene Descartes]
I have an ASP.NET application that allows users to download excel files. The code used is the following:
Code:
Response.Clear();
Response.ContentType = "application/ms-excel";
string s = "attachment; fileName=\"" + file + "\"";
Response.AddHeader("content-disposition", s);
Response.WriteFile(MapPath(file));
Response.Flush();
Response.Close();
Note: If the user selects Save, the download window does not reappear.
I have the exact same code running for pdf files. The only difference in the code is that the ContentType is "application/pdf" as opposed to "application/ms-excel". With the pdfs, though, I don't experience this problem.
Does anybody know why the download window opens twice?
Thanks.
JC
_________________________________
I think, therefore I am. [Rene Descartes]