if (File.Exists(Server.MapPath(filePath)))
{
string strFileName = Path.GetFileName(filePath).Replace(" ", "%20");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileName);
Response.Clear();
Response.WriteFile(Server.MapPath(filePath));
Response.End();//到此行也不報錯 ,就直接沒反應了
}
window.showModalDialog()彈出的窗口 里面有下載鏈接 如何讓這下載好用???求幫忙!!!
7 个解决方案
可以用超鏈接跳轉到另一個頁面,另一個頁面就只有下載功能,將值傳過去就行了
<a href="頁面.aspx?path=<%# Server.UrlEncode(Eval("path").ToString())%> "><%#Eval("path") %></a>