Problem with server.transfer

Discussion in 'ASP .Net' started by Robin, Mar 4, 2005.

  1. Robin

    Robin Guest

    When using server.transfer generates the following error.
    Thread was being aborted
    Mscorlib

    I have added

    Catch threadEx As System.Threading.ThreadAbortException

    ' do nothing

    To the code but still the error is produced, the page is not transferred to
    the other page but the same page. It then rolls back the database changes.

    What is required to get the server.transfer to work in a try catch
    statement?
     
    Robin, Mar 4, 2005
    #1
    1. Advertising

  2. Robin

    Mark Rae Guest

    "Robin" <> wrote in message
    news:OlE$...

    > When using server.transfer generates the following error.
    > Thread was being aborted


    Use Response.Redirect (<URL>, false) instead
     
    Mark Rae, Mar 4, 2005
    #2
    1. Advertising

  3. Robin

    bruce barker Guest

    Server.Transfer(), Response.End(), and Response.Redirect work by killing the
    current thread. don't catch the thread abort. they all have an option to not
    do the abort - but then the rest of the page processing continues (instead
    of terminating at the statement), which may cause you problems.


    -- bruce (sqlwork.com)




    "Robin" <> wrote in message
    news:OlE$...
    | When using server.transfer generates the following error.
    | Thread was being aborted
    | Mscorlib
    |
    | I have added
    |
    | Catch threadEx As System.Threading.ThreadAbortException
    |
    | ' do nothing
    |
    | To the code but still the error is produced, the page is not transferred
    to
    | the other page but the same page. It then rolls back the database changes.
    |
    | What is required to get the server.transfer to work in a try catch
    | statement?
    |
    |
     
    bruce barker, Mar 5, 2005
    #3
  4. Robin

    Robin Guest

    How do you not catch the thread abort but catch other errors?

    "bruce barker" <> wrote in message
    news:%...
    > Server.Transfer(), Response.End(), and Response.Redirect work by killing

    the
    > current thread. don't catch the thread abort. they all have an option to

    not
    > do the abort - but then the rest of the page processing continues (instead
    > of terminating at the statement), which may cause you problems.
    >
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    >
    > "Robin" <> wrote in message
    > news:OlE$...
    > | When using server.transfer generates the following error.
    > | Thread was being aborted
    > | Mscorlib
    > |
    > | I have added
    > |
    > | Catch threadEx As System.Threading.ThreadAbortException
    > |
    > | ' do nothing
    > |
    > | To the code but still the error is produced, the page is not transferred
    > to
    > | the other page but the same page. It then rolls back the database

    changes.
    > |
    > | What is required to get the server.transfer to work in a try catch
    > | statement?
    > |
    > |
    >
    >
     
    Robin, Mar 6, 2005
    #4
  5. like bruce said use the response.redirect(page.aspx,false)

    --
    Regards,
    Alvin Bruney

    [Shameless Author Plug]
    The Microsoft Office Web Components Black Book with .NET
    available at www.lulu.com/owc
    ------------------------------------------------------------

    "Robin" <> wrote in message
    news:...
    > How do you not catch the thread abort but catch other errors?
    >
    > "bruce barker" <> wrote in message
    > news:%...
    >> Server.Transfer(), Response.End(), and Response.Redirect work by killing

    > the
    >> current thread. don't catch the thread abort. they all have an option to

    > not
    >> do the abort - but then the rest of the page processing continues
    >> (instead
    >> of terminating at the statement), which may cause you problems.
    >>
    >>
    >> -- bruce (sqlwork.com)
    >>
    >>
    >>
    >>
    >> "Robin" <> wrote in message
    >> news:OlE$...
    >> | When using server.transfer generates the following error.
    >> | Thread was being aborted
    >> | Mscorlib
    >> |
    >> | I have added
    >> |
    >> | Catch threadEx As System.Threading.ThreadAbortException
    >> |
    >> | ' do nothing
    >> |
    >> | To the code but still the error is produced, the page is not
    >> transferred
    >> to
    >> | the other page but the same page. It then rolls back the database

    > changes.
    >> |
    >> | What is required to get the server.transfer to work in a try catch
    >> | statement?
    >> |
    >> |
    >>
    >>

    >
    >
     
    Alvin Bruney [ASP.NET MVP], Mar 6, 2005
    #5
  6. Hi Robin ....Some differences i came to find out with time.
    Hope it helps
    Patrick

    The Response.Redirect() method can be used to connect to any specified
    URL. The specified URL can point to any resource and may also contain
    query strings. The use of Response. Redirect causes an additional round
    trip to the server.

    The Server.Transfer( ) method performs a server-side redirection of a
    page. The use of Server.Transfer( ) avoids an extra round trip but only
    works with an ASPX file residing in the
    same Web application on the same Web server. Also, when you use the
    Server.Transfer method, any query string on the original request is not
    automatically passed to the new page.

    The Server.Execute method is like a function call to an ASPX file. This
    method executes the specified ASPX file and then returns execution to
    the calling ASPX page. The file specified
    as an argument to the Server.Execute( ) must be an ASPX file residing on
    the same Web server and the argument should not contain query string
    data.



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Patrick Olurotimi Ige, Mar 7, 2005
    #6
    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. Adrian Bezzina
    Replies:
    0
    Views:
    516
    Adrian Bezzina
    Aug 7, 2003
  2. gh0st54
    Replies:
    6
    Views:
    8,083
    Natty Gur
    Aug 19, 2003
  3. ewolfman
    Replies:
    4
    Views:
    3,355
    ewolfman
    Feb 13, 2006
  4. JT

    Server.Transfer vs. Server.Execute

    JT, Sep 9, 2003, in forum: ASP General
    Replies:
    1
    Views:
    95
    Ray at
    Sep 9, 2003
  5. Jim
    Replies:
    1
    Views:
    897
    Aaron Bertrand - MVP
    Jan 28, 2004
Loading...

Share This Page