标签:下载文件
public void DownLoad(string wordcode, string wordname, string wordcopyright) { string outfn = "attachment;filename={0}.txt"; Response.ContentType = "application/txt;charset=GB2312"; Response.AddHeader("Content-Disposition", string.Format(outfn, wordcode)); Response.Write(string.Format("{0}\r\n{1}", Server.UrlDecode(wordname), Server.UrlDecode(wordcopyright))); }
mvc中,view里将链接指向该action即可。
也可以通过js window.open 这个url。
标签:下载文件
原文地址:http://smartwang.blog.51cto.com/3270660/1408401