- 郁闷了一天终于搞定这个问题了,出现这个问题时候文件其实内容还是可以打开的,就是出现以上的错误原因。经过最终分析确定了具体原因,是因为在Response下载文档时候,最后需要结束
System.Web.HttpContext.Current.Response.End();否则默认为不完整下载状态。反正我加上去后就不出现以上情况了。具体代码如下:
/// <summary>
/// 下载文件
/// </summary>
public void LoadPaperTemplate(string mStrFileName)
{
FileStream fs = null;
BinaryReader br = null;
BinaryWriter brnew = null;
try
{
//给内容赋值
string path = System.Web.HttpContext.Current.Server.MapPath("~/Template");
string mStrFileRoot = string.Format("{0}\\{1}", path, mStrFileName);
if (File.Exists(mStrFileRoot))
{
fs = new System.IO.FileStream(mStrFileRoot, System.IO.FileMode.Open);
br = new BinaryReader((