zoukankan      html  css  js  c++  java
  • Response.End ,Response.Redirect、Server.Transfer 引发 “正在中止线程”异常的问题

    google后得知:Response.End 方法终止页的执行,并将此执行切换到应用程序的事件管线中的

    Application_EndRequest 事件,同时抛出ThreadAbortException 异常,异常信息为“正在中止线程”。

    解决方案
    要解决此问题,请使用下列方法之一:  对于 Response.End,调用 HttpContext.Current.ApplicationInstance.CompleteRequest 方法而不是 Response.End 以跳过 Application_EndRequest 事件的代码执行。 
     对于 Response.Redirect,请使用重载 Response.Redirect(String url, bool endResponse),该重载对 endResponse 参数传递 false 以取消对 Response.End 的内部调用。例如: 
      Response.Redirect ("nextpage.aspx", false);
                如果使用此替代方法,将执行 Response.Redirect 后面的代码。 
         对于 Server.Transfer,请改用 Server.Execute 方法。

    以上的方案是百度中找到! 

    具体为什么会抛出“正在中止线程” 这个异常 还不是很清楚,希望有大牛可以帮助解释清楚!

  • 相关阅读:
    CPU
    CentOS7 Tomcat 环境部署
    CentOS7 NTP 安装配置
    CISCO VLAN ACL
    ESXI6.0启用 snmp
    编译安装 varnish-4.1.2和yum 安装 varnish-4.0.3
    CentOS7 安装中文帮助手册
    CentOS7 学习笔记
    CentOS7 编译安装 nginx-1.10.0
    CentOS7 cacti 安装
  • 原文地址:https://www.cnblogs.com/xgq2014/p/6291958.html
Copyright © 2011-2022 走看看