2 zilu1233 zilu1233 于 2013.10.15 10:26 提问

用流下载文件时,下载文件名后的文件名为什么老是当前网页的名称,求大神指导

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呢?

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!