在asp.net MVc 页面中的一个<a/>中的服务器图片连接地址,在ie下点击是打开而不是下载,如何实现在ie下点击弹出下载提示对话框?
private void FileDownload(string FullFileName)
{
FileInfo DownloadFile = new FileInfo(FullFileName);
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();
}
试一下这段代码,你稍做修改就行了