例如服务器里的文件名是1.exe,下载后默认的文件名要变成2.exe,就是不要自己手动改文件名
解决方案 »
- 关于ASP开发中的棘手问题,希望大家不吝赐教
- 定时打开一个类似百度网站链接的功能请教。
- 求大侠们解释下?=id都是在什么时候用到,它的作用是否只有传入参数呢?
- Sys.WebForms.PageRequestManagerParserErrorException 错误
- DropDownList 事件不会发生 在线=
- 把汉字转成拼音的原理是什么,最好带个例子C#高手看看
- 关于水晶报表的问题,大家帮忙?
- 异常详细信息: System.Data.OleDb.OleDbException: “DMOLEDB.1”失败,没有可用的错误消息,结果代码: DB_E_PAR
- 类型“TextBox”的控件“Repeater1_ctl01_txKjfsBz”必须放在具有 runat=server 的窗体标记内
- 在asp.net中如何实现树型结构和数据库的链接!
- 在text中回车自动执行button事件的问题
- repeater控件如何绑定图片?
FileInfo downloadFile = new FileInfo(file);
string fileName = "哈哈.exe"; //这里你指定
Response.Buffer = false; Response.ContentType = "application/unknown";
Response.ContentEncoding = Encoding.UTF8;
Response.AddHeader("Content-Disposition","attachment; filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8) );
Response.AppendHeader("Content-Length", downloadFile.Length.ToString());
Response.WriteFile(downloadFile.FullName); Response.Flush();
Response.End();
Response.AddHeader("Content-Disposition","inline; filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8) ); 这样的话,文件名称怎么改???