Thread was being aborted

Discussion in 'ASP .Net' started by Loui Mercieca, Sep 4, 2005.

  1. Hi,

    I have a login page, and after i validate a username and password i use a
    response.redirect to the default page. The username and password are stored
    in an sql db. In the response.redirect i use some session variables to be
    added in the query string. However i am getting a "Thread was being
    aborted.". Any ideas why this could happen?

    Thanks inadvance.
    Loui Mercieca, Sep 4, 2005
    #1
    1. Advertising

  2. Loui Mercieca

    Solo Guest

    hi

    You should not include the code "Response.redirect.. " in the code blok
    "Try {} catch{}"
    Sample:
    try
    {
    //deal with the login logic
    }
    catch(Exception e)
    {

    }
    Response.redirect("default.aspx");
    Solo, Sep 4, 2005
    #2
    1. Advertising

  3. Thanks a lot, it worked. But out of curiosity, you know why the error was
    raised?? what goes through the try-catch block that raised that error?

    "Solo" <> wrote in message
    news:...
    > hi
    >
    > You should not include the code "Response.redirect.. " in the code blok
    > "Try {} catch{}"
    > Sample:
    > try
    > {
    > //deal with the login logic
    > }
    > catch(Exception e)
    > {
    >
    > }
    > Response.redirect("default.aspx");
    >
    Loui Mercieca, Sep 4, 2005
    #3
  4. Loui Mercieca

    Mark Rae Guest

    "Loui Mercieca" <> wrote in message
    news:%...

    > Thanks a lot, it worked. But out of curiosity, you know why the error was
    > raised?? what goes through the try-catch block that raised that error?


    It's a fairly common "gotcha". If you'd written:

    Response.Redirect("default.aspx", false);

    you wouldn't have got the error...
    Mark Rae, Sep 4, 2005
    #4
  5. Loui,

    this is what happens:

    "The Response.End method ends the page execution and shifts the execution to
    the Application_EndRequest event in the application's event pipeline. The
    line of code that follows Response.End is not executed.

    This problem occurs in the Response.Redirect and Server.Transfer methods
    because both methods call Response.End internally. "


    This behavior is by design. You can read about it in
    http://support.microsoft.com/default.aspx?scid=kb;[LN];312629


    Does this information help you?

    Daniel Walzenbach


    "Loui Mercieca" <> schrieb im Newsbeitrag
    news:...
    > Hi,
    >
    > I have a login page, and after i validate a username and password i use a
    > response.redirect to the default page. The username and password are
    > stored in an sql db. In the response.redirect i use some session variables
    > to be added in the query string. However i am getting a "Thread was being
    > aborted.". Any ideas why this could happen?
    >
    > Thanks inadvance.
    >
    >
    Daniel Walzenbach, Sep 4, 2005
    #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. Elliot M. Rodriguez
    Replies:
    1
    Views:
    2,920
    Elliot M. Rodriguez
    Jan 22, 2004
  2. Stephen Miller
    Replies:
    3
    Views:
    3,950
    Stephen Miller
    Jul 2, 2004
  3. Johanna
    Replies:
    0
    Views:
    595
    Johanna
    Oct 13, 2004
  4. =?Utf-8?B?Sm9oYW5uYQ==?=
    Replies:
    3
    Views:
    1,943
    =?Utf-8?B?Sm9oYW5uYQ==?=
    Oct 15, 2004
  5. peppermonkey
    Replies:
    1
    Views:
    227
    Gregory Brown
    Feb 10, 2007
Loading...

Share This Page