//TXT文件生成页面 public ActionResult FileDownLoad(string filepth) { string FileCompath= Server.MapPath(filepth); string Result = ""; StreamReader strmer = new StreamReader(FileCompath, Encoding.Default); string linetext; while ((linetext = strmer.ReadLine()) != null) { Result += linetext+"\r\n"; } Response.Headers["Content-Disposition"] = "attachment;filename=aaa.txt"; Response.Write(Result); return View(); }
时间: 2024-10-05 05:35:45