62,046
社区成员
发帖
与我相关
我的任务
分享
if (DownloadFile.Exists)
{
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
Response.AddHeader("Content-Length", DownloadFile.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
// Response.AddHeader("Content-type: text/html; charset=windows-1251");
Response.ContentType = "application/octet-stream";
//Response.ContentType = "text/html; charset=windows-1251";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
else
{
//文件不存在
}