(二).下载
1. C#:
/// <summary>
/// 文件下载
/// </summary>
/// <param name="FullFileName"></param>
private void FileDownload(string FullFileName)
{
FileInfo DownloadFile = new FileInfo(FullFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
Response.ContentType="application/octet-stream";
string FileName=DownloadFile.FullName.Substring(DownloadFile.FullName.LastIndexOf("//")+1);
Response.AppendHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(FileName,System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
// System.Web.HttpUtility.UrlDecode()提供对URL的解密,相反,System.Web.HttpUtility.UrlEncode()提供对URL的加密。