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。
时间: 2024-10-26 04:31:36