问题描述
- 用流下载文件时,下载文件名后的文件名为什么老是当前网页的名称,求大神指导
-
System.IO.FileInfo file = new System.IO.FileInfo(xpath);
Response.Clear();
Response.Charset = "GB2312 ";
Response.ContentEncoding = System.Text.Encoding.UTF8;
//Response.ContentType = "application/octet-stream ";
Response.AddHeader( "Content-Disposition ", "attachment;filename= "+aaa.doc);
Response.ContentType = "application/octet-stream ";
Response.AddHeader( "Content-Length ", file.Length.ToString());Response.WriteFile(file.FullName);
Response.End();
点击下载后,文件的默认名字问wenjian.aspx,为什么不是aaa.doc呢?
时间: 2024-11-10 01:11:02