如何通过Ajax下载文件 在网上看到关于ajax和iframe下载文件的例子,但基本上都是一样的,看起来很不理解,希望能有更具体的例子供欣赏一下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是不是这个:http://hi.baidu.com/freezesoul/blog/item/6a4c4f08d65bb6900a7b82d5.html string filePath="";ScriptManager.RegisterStartupScript(this, this.GetType(), "RegisterStartupScript", String.Format("window.navigate('DownloadFile.aspx?Filename={0}');", Server.UrlEncode(filePath)), true); DownloadFile.aspxstring Filename= Server.MapPath("../path/") +Request.QueryString["Filename"].ToString() ;Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(FileName.Substring(FileName.LastIndexOf('/') + 1), System.Text.Encoding.GetEncoding("utf-8")));Response.ContentType = "application/octet-stream";Response.WriteFile("" + dir.Trim() + FileName+"");Response.End(); RS485转换器的位置 WPF画线问题,几千条以后就有明显的延迟了。 求救:菜鸟关于变量作用域的问题!!! 计算周次的问题? 关于c#访问xml时xpath 属性值比较问题 C#菜鸟又提问了:) 关于MemoryStream! 简单问题,回答了问题的都有分!! 请问思归等高手:如何成为真正的编程高手?? Winform.Datagrid: 太复杂,结构不直观,打印功能太弱... PB的Datawindow可做的好多了!!! 如何将一个string转为int? C#连接wince 如何用folderbrowsedialog来查询根目录下子文件夹里文件的数量???
ScriptManager.RegisterStartupScript(this, this.GetType(), "RegisterStartupScript"
, String.Format("window.navigate('DownloadFile.aspx?Filename={0}');", Server.UrlEncode(filePath)), true);
DownloadFile.aspx
string Filename= Server.MapPath("../path/") +Request.QueryString["Filename"].ToString() ;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(FileName.Substring(FileName.LastIndexOf('/') + 1), System.Text.Encoding.GetEncoding("utf-8")));
Response.ContentType = "application/octet-stream";
Response.WriteFile("" + dir.Trim() + FileName+"");
Response.End();