开发者

How to handle ThreadAbortException Without Specifying False for Response.End

I know all about this exception, read the msdn article here http://support.microsoft.com/kb/312629/EN-US/ but I do not know how to handle this when my boss does not want me to throw in false for the Response.End.

Here's what I have:

        else 
        {
 try
 {
  VoidlOrder(transactionID);
 }
 catch (Exception ex)
 {
  LogError(ex.ToString());
 }
 finally
 {
     RedirectUser(sessionID,"showfmsg=1", true);
 }
        }

RedirectUser is just a utility method we run that ultimately passes in true for the reponse.redirect resopnse.end param.

So what other option is there other than putting false as this param? He's stating to catch it and do something...ok do what? I don't see any other fix than to send false into this call every time because I can't get pass this exception..I get it every time.

UPDATED

tried this but I still get a threadabortexception in the outer catch:

          else 
        {
                try
                {

                    VoidOrder(transactionID);
                }
                catch (Exception ex)
                {
                    LogError(ex.ToString());
                }
                finally
                {
                    try
                    {
                    RedirectUserBackToCheckout(sessionID, "showfmsg=1", true);
                    }
                    catch (ThreadAbortException)
                    {

                    }

                }
        }
    }
    catch (Exception ex)
    {
        // so开发者_StackOverflowme other logic
    }


Your question doesn't make sense, but you're probably looking for

catch(ThreadAbortException) { Thread.ResetAbort(); }

EDIT: You need to call Thread.ResetAbort(); in your catch block.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜