Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("../NewFile/GC/20041118949505683.doc",System.Text.Encoding.UTF8));
Response.ContentType = "application/octet-stream";
Response.WriteFile("../NewFile/GC/20041118949505683.doc");
Response.End();为什么也次下载后 系统总是提示20041118949505683.doc[1] 或者是20041118949505683.doc[2]之类的文件呢?为什么不是提示20041118949505683.doc??
请大家帮忙!

解决方案 »

  1.   

    Response.AppendHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode("../NewFile/GC/20041118949505683.doc",System.Text.Encoding.UTF8));
    Response.ContentType = "application/octet-stream";
    Response.WriteFile("../NewFile/GC/20041118949505683.doc");
    Response.Flush 
    Response.Clear()
    Response.End();上面那样试试。。
      

  2.   

    下面的代码你试试:
    FileInfo fi=new FileInfo("../NewFile/GC/20041118949505683.doc");
    Response.Clear();
    Response.ClearHeaders();
    Response.Buffer = false;
    Response.ContentType = "application/octet-stream";
    Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(fi.FullName,System.Text.Encoding.UTF8));
    Response.AppendHeader("Content-Length",fi.Length.ToString());
    Response.WriteFile(fi.FullName);
    Response.Flush();
    Response.End();