WHen I try to download from Chrome it works fine, but in IE 8 it is not downloading it is showing the error above,
protected void btn_ExcelDownload_Click(object sender, EventArgs e)
{
Grid_UserTable.Columns[0].Visible = false;
string subject = lbl_Subj.Text;
Response.Buffer = true;
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("Cache-Control", "no-store, no-cache");
Response.AddHeader("content-disposition", "attachment;filename=" + subject + "-Status.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
Grid_UserTable.RenderControl(htmlWrite);
rptList.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
When I used developer tool in chrome it gave Resource interpreted as Other but transferred with MIME type undefined. error but downloaded the file, but IE is throwing the error shown in the image, what should i do, thanks.
I am able to download the file in IE8 when I run the website using Visual studio, but when I try to download it from the website which is uploaded in server I am getting the above error,, The error is only in IE 8.
I tried changing the IE browser Compatibility mode on and off, even then I receive same error.
This is my head content
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Solved by removing this line from the code.
This might work:
Response.ClearHeaders();
Response.AddHeader("Cache-Control", "no-store, no-cache");
Source link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With