日期:2014-05-17  浏览次数:20680 次

高分求救 c# web 导出txt带来的问题
贴代码:

执行到txt的流程:
 ExportBankInfoToTxt(info.sPaymentNo, dltInfoList); //导出txt
  Response.Clear();
  ClientScript.RegisterStartupScript(this.GetType(), string.Empty,
  "<script type=\"text/javascript\">alert('{0}');location.href='{1}';</script>".FormatEx(Resources.FinpaySureSuccessful, Request.Url.PathAndQuery)); 刷新页面


导出txt函数
  private void ExportBankInfoToTxt(string sBankInfo,string fileName)
  {
  Response.Clear();
  Response.Buffer = false;
  Response.ContentEncoding = System.Text.Encoding.UTF8;
  Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(fileName) + ".txt");
  Response.ContentType = "text/plain";
  EnableViewState = false;
  Response.Write(sBankInfo.ToString());
  Response.End();

  }

问题:
  ExportBankInfoToTxt(info.sPaymentNo, dltInfoList); //导出txt
  这段执行后,后面的就不执行了,因为导出txt之前已经更改了数据,所以一定要刷新。
  但是导出txt后 后面的代码就不执行了。请问大虾 这个怎么解决

 函数里面的 Response.End(); 我去掉过 换过别的函数 还是一样 而且去掉这句话后 导出的txt里面还有网页源码字样
 

  网上我这种问题的很少 求建议 求鞭策

 






------解决方案--------------------
你当前页面和下载页面时两个单独的页面,你刷新刷自己的啊,下载另外一个一个default.aspx,一个DownLoad.aspx
探讨
不知道你说的怎么操作 我最后还要刷新