当前位置: 代码迷 >> ASP.NET >> 文件下载时,默认文件名称在哪改?解决办法
  详细解决方案

文件下载时,默认文件名称在哪改?解决办法

热度:2919   发布时间:2013-02-26 00:00:00.0
文件下载时,默认文件名称在哪改?
文件下载时,默认文件名称在哪改?
我用的是C#的最简单的代码,求高手指点一二。

private   void   FileDownLoad(string   FullFileName)
{
System.IO.FileInfo   DownloadFile=new   System.IO.FileInfo(FullFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
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();
}

------解决方案--------------------------------------------------------
Response.AppendHeader( "Content-Disposition ", "attachment;filename= "+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));


DownloadFile.FullName ------------》 这里吧
------解决方案--------------------------------------------------------
Response.AppendHeader( "Content-Disposition ", "attachment;filename= "+HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));


DownloadFile.FullName ------------》 这里吧
  相关解决方案