public void DownLoad(string wordcode, string wordname, string wordcopyright) { string outfn = "p_w_upload;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。
转载于:https://blog.51cto.com/smartwang/1408401