如何设置下载文件的名称(从文件服务器)
文件存在文件服务器上,路径假设为http://www.abc.com/D904F5FE-918C-4D72-9049-FA275976658A.XLS
现在我希望点击下载的时候(通过WEB站点,跟文件服务器不在同一台机),下载保存的文件名为"XXX.XLS"。
如何实现?求教
[解决办法]
呃?这个?很简单啊?
FileInfo aFile = new FileInfo(dt.Rows[0]["fj_guid_name"].ToString()); Response.Clear(); Response.ContentType = "application/octet-stream"; string path2 = Server.MapPath(服务器显示名); Response.AddHeader("Content-Disposition", "attachment;FileName=" + System.IO.Path.GetFileName(原名); Response.WriteFile(path2); Response.End();