2
我想导出到excel中的repeter/Gridview,this is working fine in my local machine and windows server 2003, however when I deployed on Windows server 2008 its not working properly
。这里是我的代码导出到Excel - 在Windows Server 2008 IIS7上的问题
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
string attachment = "attachment; filename=myReport.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/vnd.ms-excel";
rpt.RenderControl(htw);
Response.Write(sw.ToString());
Response.Flush();
Response.End();
服务器详细信息: Windows Server 2008和IIS7
在Mozilla所有的页面内容导出的错误,但在IE & Chrome中脱颖而出,空练成没有文件导出数据。
这不起作用 – 2010-07-23 10:17:21
什么不起作用?你有没有试过sw.Flush()? – 2010-07-23 12:27:51
你的意思是我必须添加sw.Flush()而不是Response.Flush()? – 2010-07-23 13:28:37