简单下载内容
时间:2014-05-08 16:50:54
收藏:0
阅读:269
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。
评论(0)