Question

I have a problem when I use Response.AddHeader. Firefox and Chrome work fine (They show the popup and download the file), but not in IE, where it only opens a blank popup and not do anything like download a file or show a prompt. The popup title is "-- webpage dialog".

My code is below:

byte[] bRpt = ExportReportYoStream(rptMain, ExportFormatType.Excel);
Response.ClearHeaders();
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment;filename=Test Document.xls");
Response.BinaryWrite(bRpt);
Response.Flush();
Response.End();

I have also tried many changes like:

Response.ContentType = "application/Save";
Response.ContentType = "application/octet-stream";

and many more as I can find on the internet.

Was it helpful?

Solution

okay.. this problm solved when i tried for a day and figur it out.

simple, ie not allow using "Response.AddHeader" in a popup page (i tried ie8-10). i dont know why but works on crome and ff.

if any know why ie behavior like that, i appreciate..

thanks,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top