下载自动弹出另存为的窗体?
凌珞 2010-10-29 10:15:08 我在网上查结果:string filePath = Server.MapPath(@"DownLoad\Document\" + Propath);//要下载文件的路径.
if (File.Exists(filePath))
{
FileInfo DownloadFile = new FileInfo(Propath);
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();
}
说在header里面,不懂这段代码到底怎么用?