Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

Hello everybody!

I am running into a problem. I export my gridview into ms-word. Everything is working fine in firefox. But in IE8, the name of the word file is the name of my web page. Let say download.aspx.

I am using the code like:

HttpContext.Current.Response.ContentType = "application/msword";

HttpContext

//Application specific code here

 StringWriter stringWrite = new StringWriter();HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);HttpContext.Current.Response.Write(strHTMLContent.ToString());HttpContext.Current.Response.End();HttpContext.Current.Response.Flush();

Waiting for your reply!

Pervaiz Iqbal Niazi. 

contentControl.RenderControl(htmlWrite);

strHTMLContent.Append(stringWrite.ToString());

.Current.Response.AddHeader("Content-Disposition", "inline;filename=" + strFileName.Replace(" ", "_"));

Posted

1 solution

I see you are setting the content disposition to inline. Perhaps try setting it to attachment?
Response.AddHeader( "content-disposition", "attachment; filename=MyDoc.doc");
I got that information from this webpage.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900