Adnan
asked on
HTTPResponse output stream write file to Word failed to download in IE 9....
Hi
When i try to write a byte array to a .docx file in IE 9 , it failes to download, and when i retry it opens up a word document with error message saying that the file is broken or corrupt..... And if i try to open it in FireFox every thing workes fine, so whats the problom with IE 9?
When i try to write a byte array to a .docx file in IE 9 , it failes to download, and when i retry it opens up a word document with error message saying that the file is broken or corrupt..... And if i try to open it in FireFox every thing workes fine, so whats the problom with IE 9?
private void ReturnDoc(byte[] doc, string filename)
{
HttpResponse resp = HttpContext.Current.Response;
resp.Clear();
resp.ClearContent();
resp.ClearHeaders();
resp.Buffer = true;
resp.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
resp.AddHeader("content-disposition", "attachment;filename=" + filename);
resp.AddHeader("Content-Length", doc.Length.ToString());
resp.OutputStream.Write(doc, 0, (int)doc.Length);
resp.Flush();
// resp.BinaryWrite(doc);
resp.Close();
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
970214cbbe.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Probom fixed after tairing my hair of in 2 days
ASKER