I have a web application that exports data from a gridview to Excel. It works fine in Chrome but doesn't work in IE 11 and Firefox. I see a lot of issues with this when I google it but this error seems to be unique.

protected void ExportToExcel(List<MapAmericas.Model.Project> Projects)
    Response.Buffer = true;
    Response.ContentType = "application/vnd.ms-excel";
    Response.ContentEncoding = System.Text.Encoding.Unicode;
    Response.AddHeader("content-disposition", "attachment;filename=MyFile" + DateTime.Now.ToString() + ".xls");
    Response.Charset = "";
    this.EnableViewState = false;

    System.IO.StringWriter sw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);

    GridView gv = new GridView();
    gv.AutoGenerateColumns = false;
    gv.RowDataBound += new GridViewRowEventHandler(dataExportExcel_ItemDataBound);

    gv.DataSource = Projects;

    Response.Write(AddExcelStyling()); //this contains the opening html elements
    StringBuilder sbResponseString = new StringBuilder();
    sbResponseString.Append(sw + "</body></html>");

...and the issue I'm getting has to do with not being able to access Temporary Internet Files. I get a popup "Problems during Load" and about a dozen entries: "Missing File...Temporary Internet Files\Content\" and then I get a message reading "Unable to read file". I had an image to represent the error but I'm not able to upload images. When I click on one of the links, it loads up my webpage without any styles and I don't get an excel file. Does anyone know what the issue would be?

Related posts

Recent Viewed