ASP.Net没有';t重定向
您好,我正在尝试从当前页面重定向到另一个页面,当需要重定向时,请告诉我:ASP.Net没有';t重定向,asp.net,Asp.net,您好,我正在尝试从当前页面重定向到另一个页面,当需要重定向时,请告诉我: Thread was being aborted. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated i
Thread was being aborted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Threading.ThreadAbortException: Thread was being aborted.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ThreadAbortException: Thread was being aborted.]
System.Web.HttpContext.InvokeCancellableCallback(WaitCallback callback, Object state) +298
System.Web.Util.<>c__DisplayClass1.<WrapContinuation>b__0() +37
System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.<.cctor>b__3(Object state) +37
System.Web.<>c__DisplayClass7.<Post>b__6() +15
System.Web.Util.SynchronizationHelper.SafeWrapCallback(Action action) +91
响应。重定向
将触发ThreadAbortException
在绝大多数情况下,可以放心地忽略这一点
protected void Button1_Click(object sender, EventArgs e)
{
try{
Response.Redirect("/seller/ven_mainwin/recharge/recharge.aspx");
}
catch (System.Threading.ThreadAbortException e){
// do nothing. This exception can be ignored.
}
}
可能重复的,我想说异常本身可以忽略,但是你不应该吃异常。
protected void Button1_Click(object sender, EventArgs e)
{
try{
Response.Redirect("/seller/ven_mainwin/recharge/recharge.aspx");
}
catch (System.Threading.ThreadAbortException e){
// do nothing. This exception can be ignored.
}
}
Response.Redirect(url, false);
Context.ApplicationInstance.CompleteRequest();