用以下代码下载excel文件的时候,在弹出筐选择【打开或保存】的时候,当打开一些内容多的excel文件的时候打开的是空或者不能打开,但保存到本地可以正常打开,什么回事呢?我尝试把Response.Flush()这句去掉,问题依旧 Response.Clear()
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(ModelUrl, System.Text.Encoding.UTF8))
Response.WriteFile(ModelUrl)
Response.Flush()
Response.End()
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(ModelUrl, System.Text.Encoding.UTF8))
Response.WriteFile(ModelUrl)
Response.Flush()
Response.End()
解决方案 »
- 急啊!哪位高手帮忙解决JavaScript(asp.net c#)脚本问题!!
- 需要利用Ext.NET编写一个程序
- asp.net登陆框问题,我想把登陆框类似cs那样的
- .NET数据绑定问题,请前辈门多多指点!
- Html页面调用代码函数
- jmail中的Jmail.Send("smtp.sina.com.cn",false),后面的那个false是什么意思,用TRUE行不行
- 大过年的郁闷了我3天3夜的问题,100祝大家身体健康,发财!
- 首页导航栏上第一行的下拉菜单被第二行导航栏挡住了,请问该怎样改代码才不被第二行导航栏挡住,谢谢!!!
- asp.net中两个textbox控件
- Access中的存储过程怎么写
- document.frmRing.submit()问题
- 请教高手电子邮件的问题
response.Clear();
response.WriteFile(physicPath + fileName);
string httpHeader="attachment;filename=MonthBudget.xls";
response.AppendHeader("Content-Disposition", httpHeader);
response.Flush();
System.IO.File.Delete(physicPath + fileName);//删除临时文件
response.End();
下载文件出现提示框或者直接显示在浏览器中
Response.Clear()
Response.ClearHeaders()
Response.Buffer = False
Response.Charset = "GB2312"
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8))
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString)
Response.WriteFile(DownloadFile.FullName)
Response.Flush()
Response.End()