Exception "Thread was being aborted." with Server.Transfer()

Discussion in 'ASP .Net' started by Totto, Aug 24, 2006.

  1. Totto

    Totto Guest

    Hi,
    I'm doing a server.transfer from a click event of a button,
    but an exception is raised with "Thread was being aborted"

    Anyone know why?

    Thanks Tor
     
    Totto, Aug 24, 2006
    #1
    1. Advertising

  2. Hi,

    Totto wrote:
    > Hi,
    > I'm doing a server.transfer from a click event of a button,
    > but an exception is raised with "Thread was being aborted"
    >
    > Anyone know why?
    >
    > Thanks Tor


    This exception is thrown by the system when a redirection occurs. There
    is nothing you can do against it. You must catch it (using try/catch),
    but note that the exception is propagated even if you catch it in the
    lower layers of your system.

    "Transfer calls End, which throws a ThreadAbortException exception upon
    completion."

    http://msdn2.microsoft.com/en-us/library/y4k58xk7.aspx

    "ThreadAbortException is a special exception that can be caught, but it
    will automatically be raised again at the end of the catch block."

    http://msdn2.microsoft.com/en-us/library/system.threading.threadabortexception.aspx

    HTH,
    Laurent
    --
    Laurent Bugnion, GalaSoft
    Software engineering: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Laurent Bugnion, Aug 24, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?QXVndXN0aW4gUHJhc2FubmE=?=, Aug 24, 2006
    #3
  4. Totto

    Kevin Jones Guest

    > I'm doing a server.transfer from a click event of a button,
    > but an exception is raised with "Thread was being aborted"


    When you do a Server.Transfer, you are saying to ASP.Net, "end the
    processing of the current page and transfer control to the new page, and
    don't come back to the current page when you are finished!"

    To do that ASP.Net causes an exception on the current thread, that will
    end the processing of the current page. You can't stop this exception
    and you don't need to handle it.

    Where are you seeing the exception?

    Kevin

    Totto wrote:
    > Hi,
    > I'm doing a server.transfer from a click event of a button,
    > but an exception is raised with "Thread was being aborted"
    >
    > Anyone know why?
    >
    > Thanks Tor
    >
    >
     
    Kevin Jones, Aug 24, 2006
    #4
  5. http://support.microsoft.com/kb/312629/EN-US

    ....recommends using Server.Execute, instead of Server.Transfer,
    to work around that problem.



    Juan T. Llibre, asp.net MVP
    aspnetfaq.com : http://www.aspnetfaq.com/
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en espaƱol : http://asp.net.do/foros/
    ===================================
    "Laurent Bugnion" <> wrote in message
    news:u41%...
    > Hi,
    >
    > Totto wrote:
    >> Hi,
    >> I'm doing a server.transfer from a click event of a button,
    >> but an exception is raised with "Thread was being aborted"
    >>
    >> Anyone know why?
    >>
    >> Thanks Tor

    >
    > This exception is thrown by the system when a redirection occurs. There is nothing you can do
    > against it. You must catch it (using try/catch), but note that the exception is propagated even if
    > you catch it in the lower layers of your system.
    >
    > "Transfer calls End, which throws a ThreadAbortException exception upon completion."
    >
    > http://msdn2.microsoft.com/en-us/library/y4k58xk7.aspx
    >
    > "ThreadAbortException is a special exception that can be caught, but it will automatically be
    > raised again at the end of the catch block."
    >
    > http://msdn2.microsoft.com/en-us/library/system.threading.threadabortexception.aspx
    >
    > HTH,
    > Laurent
     
    Juan T. Llibre, Aug 24, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Miller
    Replies:
    3
    Views:
    4,033
    Stephen Miller
    Jul 2, 2004
  2. Johanna
    Replies:
    0
    Views:
    623
    Johanna
    Oct 13, 2004
  3. =?Utf-8?B?Sm9oYW5uYQ==?=
    Replies:
    3
    Views:
    2,001
    =?Utf-8?B?Sm9oYW5uYQ==?=
    Oct 15, 2004
  4. Alan Silver
    Replies:
    5
    Views:
    23,130
    Alan Silver
    Dec 6, 2005
  5. Jeff
    Replies:
    3
    Views:
    11,466
    sebichondo
    Feb 3, 2011
Loading...

Share This Page