Response.Redirect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kerri

    #1

    Response.Redirect

    Hi,

    I have do some Redirects in my applitcaion.

    For example, when the use rhas logged in successfully I
    redirect them to a different page.

    In my Redirect all I was doing was a..

    Response.Redire ct("SomePage.as px")

    When I used above I got below error.

    2) Exception Information
    *************** *************** ***************
    Exception Type: System.Threadin g.ThreadAbortEx ception
    ExceptionState:
    System.Web.Http Application+Can celModuleExcept ion
    Message: Thread was being aborted.
    TargetSite: Void AbortInternal()
    HelpLink: NULL
    Source: mscorlib

    StackTrace Information
    *************** *************** ***************
    at System.Threadin g.Thread.AbortI nternal()
    at System.Threadin g.Thread.Abort( Object stateInfo)
    at System.Web.Http Response.End()
    at System.Web.Http Response.Redire ct(String url, Boolean
    endResponse)
    at System.Web.Http Response.Redire ct(String url)



    I have now changed all my Redirects to be..

    Response.Redire ct("MyPage.aspx ", False)

    I use False everywhere as I don't want to ever end the
    execution of my page.

    I have 2 questions-:

    (i) Why was I getting above error. Do I have to pass in a
    boolean also to my Response.Redire ct?
    (ii) When would I use True. Surely I will never want to
    finish executing the page I am on so it will always be
    False???

    Any advice on this is much appreciated.




  • AlexB

    #2
    Response.Redire ct

    ..Redirect has two overloads, which you've specified. I've
    gotten the error that you've indicated when I try to step
    into the call when I'm debugging, but not when it executes
    normally.

    [color=blue]
    >-----Original Message-----
    >Hi,
    >
    >I have do some Redirects in my applitcaion.
    >
    >For example, when the use rhas logged in successfully I
    >redirect them to a different page.
    >
    >In my Redirect all I was doing was a..
    >
    >Response.Redir ect("SomePage.a spx")
    >
    >When I used above I got below error.
    >
    >2) Exception Information
    >************** *************** *************** *
    >Exception Type: System.Threadin g.ThreadAbortEx ception
    >ExceptionState :
    >System.Web.Htt pApplication+Ca ncelModuleExcep tion
    >Message: Thread was being aborted.
    >TargetSite: Void AbortInternal()
    >HelpLink: NULL
    >Source: mscorlib
    >
    >StackTrace Information
    >************** *************** *************** *
    > at System.Threadin g.Thread.AbortI nternal()
    > at System.Threadin g.Thread.Abort( Object stateInfo)
    > at System.Web.Http Response.End()
    > at System.Web.Http Response.Redire ct(String url,[/color]
    Boolean[color=blue]
    >endResponse)
    > at System.Web.Http Response.Redire ct(String url)
    >
    >
    >
    >I have now changed all my Redirects to be..
    >
    >Response.Redir ect("MyPage.asp x", False)
    >
    >I use False everywhere as I don't want to ever end the
    >execution of my page.
    >
    >I have 2 questions-:
    >
    >(i) Why was I getting above error. Do I have to pass in a
    >boolean also to my Response.Redire ct?
    >(ii) When would I use True. Surely I will never want to
    >finish executing the page I am on so it will always be
    >False???
    >
    >Any advice on this is much appreciated.
    >
    >
    >
    >
    >.
    >[/color]

    Comment

    • Christopher Bova

      #3
      Response.Redire ct

      I've run across this before- the exception you are dealing
      with can best be thought of not as an error but as a
      notification that request processing is ending because the
      user is being redirected. It's completely safe to just
      ignore it.
      [color=blue]
      >-----Original Message-----
      >..Redirect has two overloads, which you've specified.[/color]
      I've[color=blue]
      >gotten the error that you've indicated when I try to step
      >into the call when I'm debugging, but not when it[/color]
      executes[color=blue]
      >normally.
      >
      >[color=green]
      >>-----Original Message-----
      >>Hi,
      >>
      >>I have do some Redirects in my applitcaion.
      >>
      >>For example, when the use rhas logged in successfully I
      >>redirect them to a different page.
      >>
      >>In my Redirect all I was doing was a..
      >>
      >>Response.Redi rect("SomePage. aspx")
      >>
      >>When I used above I got below error.
      >>
      >>2) Exception Information
      >>************* *************** *************** **
      >>Exception Type: System.Threadin g.ThreadAbortEx ception
      >>ExceptionStat e:
      >>System.Web.Ht tpApplication+C ancelModuleExce ption
      >>Message: Thread was being aborted.
      >>TargetSite: Void AbortInternal()
      >>HelpLink: NULL
      >>Source: mscorlib
      >>
      >>StackTrace Information
      >>************* *************** *************** **
      >> at System.Threadin g.Thread.AbortI nternal()
      >> at System.Threadin g.Thread.Abort( Object stateInfo)
      >> at System.Web.Http Response.End()
      >> at System.Web.Http Response.Redire ct(String url,[/color]
      >Boolean[color=green]
      >>endResponse )
      >> at System.Web.Http Response.Redire ct(String url)
      >>
      >>
      >>
      >>I have now changed all my Redirects to be..
      >>
      >>Response.Redi rect("MyPage.as px", False)
      >>
      >>I use False everywhere as I don't want to ever end the
      >>execution of my page.
      >>
      >>I have 2 questions-:
      >>
      >>(i) Why was I getting above error. Do I have to pass in[/color][/color]
      a[color=blue][color=green]
      >>boolean also to my Response.Redire ct?
      >>(ii) When would I use True. Surely I will never want to
      >>finish executing the page I am on so it will always be
      >>False???
      >>
      >>Any advice on this is much appreciated.
      >>
      >>
      >>
      >>
      >>.
      >>[/color]
      >.
      >[/color]

      Comment

      Working...