Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource interpreted as Other but transferred with MIME type undefined. error for IE (Asp.net Website)

enter image description here

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" />
like image 474
John Avatar asked Nov 15 '11 15:11

John


2 Answers

  Response.Cache.SetCacheability(HttpCacheability.NoCache);

Solved by removing this line from the code.

like image 55
John Avatar answered Nov 02 '22 00:11

John


This might work:

Response.ClearHeaders();
Response.AddHeader("Cache-Control", "no-store, no-cache");

Source link

like image 2
NaveenBhat Avatar answered Nov 02 '22 00:11

NaveenBhat