bizaar exception that isn't really an exception

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: bizaar exception that isn't really an exception

    well, threadabortexception didn't mention anything about response.redirect,
    that's why i didn't see anything.

    but, thanks for the info, that would explain it... sort of... why doesn't
    this exception get caught in the debugger? ie, break on all errors is
    selected, but this error isn't caught.

    jeff

    "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    news:uRW6C3gODHA.1024@TK2MSFTNGP12.phx.gbl...
    > As Jason said: take a look at ThreadAbortException (and also
    > response.redirect).
    >
    > The following are taken from the MSDN Help:
    >
    > HttpResponse.Redirect(string):
    > Redirect calls End which raises a ThreadAbortException exception upon
    > completion.
    >
    > ThreadAbortException:
    > When a call is made to the Abort method to destroy a thread, the
    > common language runtime throws a ThreadAbortException.
    > ThreadAbortException is a special exception that can be caught, but it
    > will automatically be raised again at the end of the catch block.
    >
    > I hope that helps.
    > Scott
    >
    > "jeff" <vader1000x@yahoo.com> wrote in message
    > news:OE7CIqdODHA.2480@tk2msftngp13.phx.gbl...
    > > happens when you issue thread.abort on a thread. this isn't
    > happening.
    > > it's a single thread and nowhere do i do any thread controls.
    > >
    > > jeff
    > >
    > > "Jason" <123456789clopper@totalise.co.uk987654321> wrote in message
    > > news:e6gmIfdODHA.2636@TK2MSFTNGP10.phx.gbl...
    > > > no offense here but you really should read up on
    > ThreadAbortException and
    > > > its siblings
    > > >
    > > >
    > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > news:uZcMStbODHA.3192@TK2MSFTNGP10.phx.gbl...
    > > > > i am using asp .net 1.1. i am having a very strange problem. i
    > had a
    > > > batch
    > > > > of code that was working great. i made a couple of changes and
    > i
    > > noticed
    > > > it
    > > > > was always throwing an exception. i worked on it and below is
    > the code
    > > in
    > > > > the event that causes the pseudo exception. here is the strange
    > thing -
    > > i
    > > > > have my debugger set to break on all errors regardless of
    > whether it is
    > > > > handled or not. it never breaks into the debugger. the
    > exception
    > > > reported
    > > > > is "thread is aborting" or something like that. this is bogus
    > because
    > > i'm
    > > > > not running a multi-threaded app! so, since i was convinced
    > this was a
    > > > > bogus error, i moved the response.redirect outside of the
    > try/catch
    > > block
    > > > > and it worked fine. can anybody explain this to me? also, this
    > code
    > > used
    > > > > to work fine.
    > > > >
    > > > > ' try to get data
    > > > > Try
    > > > >
    > > > > ' if made it this far, redirect to the report page.
    > > > >
    > > > > Response.Redirect("report.aspx")
    > > > >
    > > > > Catch ex As Exception
    > > > >
    > > > > ' set error condition to prompt user
    > > > >
    > > > > Session.Item(clsConstants.clsSession.MAIN_ERROR) = True
    > > > >
    > > > > Session.Item(clsConstants.clsSession.EXCEPTION) = ex
    > > > >
    > > > > DisplayError(Session.Item(clsConstants.clsSession. EXCEPTION),
    > Page,
    > > True)
    > > > >
    > > > > End Try
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    jeff Guest

  2. Similar Questions and Discussions

    1. The server threw an exception. (Exception
      I am getting The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) When i try to open any file using Adobe ...
    2. #32101 [Com]: Exception in unknown on line 0 when throwing exception inside exception handler
      ID: 32101 Comment by: dhopkins at DonHopkins dot com Reported By: ceefour at gauldong dot net Status: No...
    3. SoapExtension for Global Exception handling; but prevent exception from propagating!!
      Hi, I wrote a SoapExtension for Global Exception handling in Webservice and it works!!!! Now i want to catch the exception that happen in the...
    4. ASP catch exception
      I use the following code and get the following error message in my ASP page(not .net). Please help try mycode Catch ex As Exception...
    5. Strange exception ??
      Greatings. We are developint an application using struts on linux. We run a db2 server (v8.1) on linux. When trying to access using JDBC drivers I...
  3. #2

    Default Re: bizaar exception that isn't really an exception

    another interesting thought... why can i put this outside a try/catch and it
    doesn't blow things up? if it raises an exception, the code doesn't seem to
    care...

    jeff

    "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    news:uRW6C3gODHA.1024@TK2MSFTNGP12.phx.gbl...
    > As Jason said: take a look at ThreadAbortException (and also
    > response.redirect).
    >
    > The following are taken from the MSDN Help:
    >
    > HttpResponse.Redirect(string):
    > Redirect calls End which raises a ThreadAbortException exception upon
    > completion.
    >
    > ThreadAbortException:
    > When a call is made to the Abort method to destroy a thread, the
    > common language runtime throws a ThreadAbortException.
    > ThreadAbortException is a special exception that can be caught, but it
    > will automatically be raised again at the end of the catch block.
    >
    > I hope that helps.
    > Scott
    >
    > "jeff" <vader1000x@yahoo.com> wrote in message
    > news:OE7CIqdODHA.2480@tk2msftngp13.phx.gbl...
    > > happens when you issue thread.abort on a thread. this isn't
    > happening.
    > > it's a single thread and nowhere do i do any thread controls.
    > >
    > > jeff
    > >
    > > "Jason" <123456789clopper@totalise.co.uk987654321> wrote in message
    > > news:e6gmIfdODHA.2636@TK2MSFTNGP10.phx.gbl...
    > > > no offense here but you really should read up on
    > ThreadAbortException and
    > > > its siblings
    > > >
    > > >
    > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > news:uZcMStbODHA.3192@TK2MSFTNGP10.phx.gbl...
    > > > > i am using asp .net 1.1. i am having a very strange problem. i
    > had a
    > > > batch
    > > > > of code that was working great. i made a couple of changes and
    > i
    > > noticed
    > > > it
    > > > > was always throwing an exception. i worked on it and below is
    > the code
    > > in
    > > > > the event that causes the pseudo exception. here is the strange
    > thing -
    > > i
    > > > > have my debugger set to break on all errors regardless of
    > whether it is
    > > > > handled or not. it never breaks into the debugger. the
    > exception
    > > > reported
    > > > > is "thread is aborting" or something like that. this is bogus
    > because
    > > i'm
    > > > > not running a multi-threaded app! so, since i was convinced
    > this was a
    > > > > bogus error, i moved the response.redirect outside of the
    > try/catch
    > > block
    > > > > and it worked fine. can anybody explain this to me? also, this
    > code
    > > used
    > > > > to work fine.
    > > > >
    > > > > ' try to get data
    > > > > Try
    > > > >
    > > > > ' if made it this far, redirect to the report page.
    > > > >
    > > > > Response.Redirect("report.aspx")
    > > > >
    > > > > Catch ex As Exception
    > > > >
    > > > > ' set error condition to prompt user
    > > > >
    > > > > Session.Item(clsConstants.clsSession.MAIN_ERROR) = True
    > > > >
    > > > > Session.Item(clsConstants.clsSession.EXCEPTION) = ex
    > > > >
    > > > > DisplayError(Session.Item(clsConstants.clsSession. EXCEPTION),
    > Page,
    > > True)
    > > > >
    > > > > End Try
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    jeff Guest

  4. #3

    Default Re: bizaar exception that isn't really an exception

    i already changed my code to catch the threadabortexception and just do
    nothing with it.... thanks.

    jeff

    "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    news:eLWDzltODHA.2160@TK2MSFTNGP11.phx.gbl...
    > Jeff,
    >
    > This is _only_ my view of things, maybe some MS person or other more
    > knowing person has a better answer, but I'll explain the way that I
    > see these things.
    >
    > Each request is handled by "your application" (the aspnet_wp.exe
    > process). When a new request comes in, the process creates a new
    > thread to handle the request. For me, this is why, when the
    > threadabort exception is thrown in this thread, there is nothing to
    > blow up, except the thread, and it dies anyway. Response.Redirect()
    > must be a bit fancy though, since, even to me, it seems to be killing
    > the very thread it is running on, but no matter. Ignore this detail.
    >
    > About catching the error: this i do all the time. As it said in the
    > ThreadAbortException help though, the exception is rethrown
    > immediately after the catch block, so if you had something like the
    > following:
    >
    > // handles pageload event
    > private void Page_Load(object, args) {
    > // do some stuff
    > try { Response.Redirect([url]http://www.thegameoflife.com[/url]) }
    > catch (Exception ex) {
    > Console.WriteLine(ex.GetType().ToString(); }
    > }
    >
    > the exception would be caught and
    > "System.Threading.ThreadAbortException" should (I haven't tried it
    > lately) be written to the output window. Note that if you do a
    > Response.Write(ex.Message) it will work, but is meaningless since the
    > response is redirected, and therefore cleared. In general I would
    > avoid having a Response.Redirect() inside a try/catch, because you
    > always know it's going to throw an exception and, as the gurus tell
    > us, throwing & catching the exceptions has a bit of performance
    > overhead.
    >
    > Let me know if that clear things up or makes them more confusing.
    > scott
    >
    > "jeff" <vader1000x@yahoo.com> wrote in message
    > news:u3QgC9kODHA.3880@tk2msftngp13.phx.gbl...
    > > another interesting thought... why can i put this outside a
    > try/catch and it
    > > doesn't blow things up? if it raises an exception, the code doesn't
    > seem to
    > > care...
    > >
    > > jeff
    > >
    > > "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    > > news:uRW6C3gODHA.1024@TK2MSFTNGP12.phx.gbl...
    > > > As Jason said: take a look at ThreadAbortException (and also
    > > > response.redirect).
    > > >
    > > > The following are taken from the MSDN Help:
    > > >
    > > > HttpResponse.Redirect(string):
    > > > Redirect calls End which raises a ThreadAbortException exception
    > upon
    > > > completion.
    > > >
    > > > ThreadAbortException:
    > > > When a call is made to the Abort method to destroy a thread, the
    > > > common language runtime throws a ThreadAbortException.
    > > > ThreadAbortException is a special exception that can be caught,
    > but it
    > > > will automatically be raised again at the end of the catch block.
    > > >
    > > > I hope that helps.
    > > > Scott
    > > >
    > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > news:OE7CIqdODHA.2480@tk2msftngp13.phx.gbl...
    > > > > happens when you issue thread.abort on a thread. this isn't
    > > > happening.
    > > > > it's a single thread and nowhere do i do any thread controls.
    > > > >
    > > > > jeff
    > > > >
    > > > > "Jason" <123456789clopper@totalise.co.uk987654321> wrote in
    > message
    > > > > news:e6gmIfdODHA.2636@TK2MSFTNGP10.phx.gbl...
    > > > > > no offense here but you really should read up on
    > > > ThreadAbortException and
    > > > > > its siblings
    > > > > >
    > > > > >
    > > > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > > > news:uZcMStbODHA.3192@TK2MSFTNGP10.phx.gbl...
    > > > > > > i am using asp .net 1.1. i am having a very strange
    > problem. i
    > > > had a
    > > > > > batch
    > > > > > > of code that was working great. i made a couple of changes
    > and
    > > > i
    > > > > noticed
    > > > > > it
    > > > > > > was always throwing an exception. i worked on it and below
    > is
    > > > the code
    > > > > in
    > > > > > > the event that causes the pseudo exception. here is the
    > strange
    > > > thing -
    > > > > i
    > > > > > > have my debugger set to break on all errors regardless of
    > > > whether it is
    > > > > > > handled or not. it never breaks into the debugger. the
    > > > exception
    > > > > > reported
    > > > > > > is "thread is aborting" or something like that. this is
    > bogus
    > > > because
    > > > > i'm
    > > > > > > not running a multi-threaded app! so, since i was convinced
    > > > this was a
    > > > > > > bogus error, i moved the response.redirect outside of the
    > > > try/catch
    > > > > block
    > > > > > > and it worked fine. can anybody explain this to me? also,
    > this
    > > > code
    > > > > used
    > > > > > > to work fine.
    > > > > > >
    > > > > > > ' try to get data
    > > > > > > Try
    > > > > > >
    > > > > > > ' if made it this far, redirect to the report page.
    > > > > > >
    > > > > > > Response.Redirect("report.aspx")
    > > > > > >
    > > > > > > Catch ex As Exception
    > > > > > >
    > > > > > > ' set error condition to prompt user
    > > > > > >
    > > > > > > Session.Item(clsConstants.clsSession.MAIN_ERROR) = True
    > > > > > >
    > > > > > > Session.Item(clsConstants.clsSession.EXCEPTION) = ex
    > > > > > >
    > > > > > >
    > DisplayError(Session.Item(clsConstants.clsSession. EXCEPTION),
    > > > Page,
    > > > > True)
    > > > > > >
    > > > > > > End Try
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    jeff Guest

  5. #4

    Default Re: bizaar exception that isn't really an exception

    Scott

    That makes for a slow exception handler. Probably quicker to catch it.
    Besides - that is a very Vb specific command. There is no C# equivalent
    other than coding that When statement in the block. Would be interesting to
    see the MSIL on that one - its going to be in the exception handling block
    in any case i am sure.

    Cheers

    Jason



    "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    news:ebiA295ODHA.3152@TK2MSFTNGP10.phx.gbl...
    > jeff,
    >
    > Somewhere deep in the mysterious jungle of the MS help, they recommend
    > to do nothing with an exception unless you are going to handle it. In
    > the case of just try (response.redirect) catch (do nothing), it does
    > not make sense to catch the exception. That said, it doesn't really
    > hurt. Here's another something I stumbled on recently:
    >
    > Try
    > 'do some stuff
    > Response.Redirect("foo.aspx")
    > Catch ex As Exception When Not TypeOf ex Is ThreadAbortException
    > 'handle other kinds of exceptions
    > End Try
    >
    > Hope that helps,
    > scott
    >
    > "jeff" <vader1000x@yahoo.com> wrote in message
    > news:%231JSja1ODHA.4024@tk2msftngp13.phx.gbl...
    > > i already changed my code to catch the threadabortexception and just
    > do
    > > nothing with it.... thanks.
    > >
    > > jeff
    > >
    > > "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    > > news:eLWDzltODHA.2160@TK2MSFTNGP11.phx.gbl...
    > > > Jeff,
    > > >
    > > > This is _only_ my view of things, maybe some MS person or other
    > more
    > > > knowing person has a better answer, but I'll explain the way that
    > I
    > > > see these things.
    > > >
    > > > Each request is handled by "your application" (the aspnet_wp.exe
    > > > process). When a new request comes in, the process creates a new
    > > > thread to handle the request. For me, this is why, when the
    > > > threadabort exception is thrown in this thread, there is nothing
    > to
    > > > blow up, except the thread, and it dies anyway.
    > Response.Redirect()
    > > > must be a bit fancy though, since, even to me, it seems to be
    > killing
    > > > the very thread it is running on, but no matter. Ignore this
    > detail.
    > > >
    > > > About catching the error: this i do all the time. As it said in
    > the
    > > > ThreadAbortException help though, the exception is rethrown
    > > > immediately after the catch block, so if you had something like
    > the
    > > > following:
    > > >
    > > > // handles pageload event
    > > > private void Page_Load(object, args) {
    > > > // do some stuff
    > > > try { Response.Redirect([url]http://www.thegameoflife.com[/url]) }
    > > > catch (Exception ex) {
    > > > Console.WriteLine(ex.GetType().ToString(); }
    > > > }
    > > >
    > > > the exception would be caught and
    > > > "System.Threading.ThreadAbortException" should (I haven't tried it
    > > > lately) be written to the output window. Note that if you do a
    > > > Response.Write(ex.Message) it will work, but is meaningless since
    > the
    > > > response is redirected, and therefore cleared. In general I would
    > > > avoid having a Response.Redirect() inside a try/catch, because you
    > > > always know it's going to throw an exception and, as the gurus
    > tell
    > > > us, throwing & catching the exceptions has a bit of performance
    > > > overhead.
    > > >
    > > > Let me know if that clear things up or makes them more confusing.
    > > > scott
    > > >
    > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > news:u3QgC9kODHA.3880@tk2msftngp13.phx.gbl...
    > > > > another interesting thought... why can i put this outside a
    > > > try/catch and it
    > > > > doesn't blow things up? if it raises an exception, the code
    > doesn't
    > > > seem to
    > > > > care...
    > > > >
    > > > > jeff
    > > > >
    > > > > "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    > > > > news:uRW6C3gODHA.1024@TK2MSFTNGP12.phx.gbl...
    > > > > > As Jason said: take a look at ThreadAbortException (and also
    > > > > > response.redirect).
    > > > > >
    > > > > > The following are taken from the MSDN Help:
    > > > > >
    > > > > > HttpResponse.Redirect(string):
    > > > > > Redirect calls End which raises a ThreadAbortException
    > exception
    > > > upon
    > > > > > completion.
    > > > > >
    > > > > > ThreadAbortException:
    > > > > > When a call is made to the Abort method to destroy a thread,
    > the
    > > > > > common language runtime throws a ThreadAbortException.
    > > > > > ThreadAbortException is a special exception that can be
    > caught,
    > > > but it
    > > > > > will automatically be raised again at the end of the catch
    > block.
    > > > > >
    > > > > > I hope that helps.
    > > > > > Scott
    > > > > >
    > > > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > > > news:OE7CIqdODHA.2480@tk2msftngp13.phx.gbl...
    > > > > > > happens when you issue thread.abort on a thread. this isn't
    > > > > > happening.
    > > > > > > it's a single thread and nowhere do i do any thread
    > controls.
    > > > > > >
    > > > > > > jeff
    > > > > > >
    > > > > > > "Jason" <123456789clopper@totalise.co.uk987654321> wrote in
    > > > message
    > > > > > > news:e6gmIfdODHA.2636@TK2MSFTNGP10.phx.gbl...
    > > > > > > > no offense here but you really should read up on
    > > > > > ThreadAbortException and
    > > > > > > > its siblings
    > > > > > > >
    > > > > > > >
    > > > > > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > > > > > news:uZcMStbODHA.3192@TK2MSFTNGP10.phx.gbl...
    > > > > > > > > i am using asp .net 1.1. i am having a very strange
    > > > problem. i
    > > > > > had a
    > > > > > > > batch
    > > > > > > > > of code that was working great. i made a couple of
    > changes
    > > > and
    > > > > > i
    > > > > > > noticed
    > > > > > > > it
    > > > > > > > > was always throwing an exception. i worked on it and
    > below
    > > > is
    > > > > > the code
    > > > > > > in
    > > > > > > > > the event that causes the pseudo exception. here is the
    > > > strange
    > > > > > thing -
    > > > > > > i
    > > > > > > > > have my debugger set to break on all errors regardless
    > of
    > > > > > whether it is
    > > > > > > > > handled or not. it never breaks into the debugger. the
    > > > > > exception
    > > > > > > > reported
    > > > > > > > > is "thread is aborting" or something like that. this is
    > > > bogus
    > > > > > because
    > > > > > > i'm
    > > > > > > > > not running a multi-threaded app! so, since i was
    > convinced
    > > > > > this was a
    > > > > > > > > bogus error, i moved the response.redirect outside of
    > the
    > > > > > try/catch
    > > > > > > block
    > > > > > > > > and it worked fine. can anybody explain this to me?
    > also,
    > > > this
    > > > > > code
    > > > > > > used
    > > > > > > > > to work fine.
    > > > > > > > >
    > > > > > > > > ' try to get data
    > > > > > > > > Try
    > > > > > > > >
    > > > > > > > > ' if made it this far, redirect to the report page.
    > > > > > > > >
    > > > > > > > > Response.Redirect("report.aspx")
    > > > > > > > >
    > > > > > > > > Catch ex As Exception
    > > > > > > > >
    > > > > > > > > ' set error condition to prompt user
    > > > > > > > >
    > > > > > > > > Session.Item(clsConstants.clsSession.MAIN_ERROR) = True
    > > > > > > > >
    > > > > > > > > Session.Item(clsConstants.clsSession.EXCEPTION) = ex
    > > > > > > > >
    > > > > > > > >
    > > > DisplayError(Session.Item(clsConstants.clsSession. EXCEPTION),
    > > > > > Page,
    > > > > > > True)
    > > > > > > > >
    > > > > > > > > End Try
    > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Jason Guest

  6. #5

    Default Re: bizaar exception that isn't really an exception

    Jason,

    Yes I agree. I wrote in VB for about 6 months, got comfortable with
    the framework, then switched to c#. (I actually had to look up the
    exact syntax for the When clause in old code.)

    I prefer setting a flag in the catch for stuff like that now. I would
    do

    Dim flag as Boolean

    Try
    'some stuff
    flag = true
    Catch ex As Exception
    'exception handling code
    flag = false
    End Try

    If flag Then Response.Redirect("")

    for example. I would be interested in something a bit more elegate
    though.

    Scott


    "Jason" <123456789clopper@totalise.co.uk987654321> wrote in message
    news:eryTw39ODHA.2636@TK2MSFTNGP10.phx.gbl...
    > Scott
    >
    > That makes for a slow exception handler. Probably quicker to catch
    it.
    > Besides - that is a very Vb specific command. There is no C#
    equivalent
    > other than coding that When statement in the block. Would be
    interesting to
    > see the MSIL on that one - its going to be in the exception handling
    block
    > in any case i am sure.
    >
    > Cheers
    >
    > Jason
    >
    >
    >
    > "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    > news:ebiA295ODHA.3152@TK2MSFTNGP10.phx.gbl...
    > > jeff,
    > >
    > > Somewhere deep in the mysterious jungle of the MS help, they
    recommend
    > > to do nothing with an exception unless you are going to handle it.
    In
    > > the case of just try (response.redirect) catch (do nothing), it
    does
    > > not make sense to catch the exception. That said, it doesn't
    really
    > > hurt. Here's another something I stumbled on recently:
    > >
    > > Try
    > > 'do some stuff
    > > Response.Redirect("foo.aspx")
    > > Catch ex As Exception When Not TypeOf ex Is ThreadAbortException
    > > 'handle other kinds of exceptions
    > > End Try
    > >
    > > Hope that helps,
    > > scott
    > >
    > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > news:%231JSja1ODHA.4024@tk2msftngp13.phx.gbl...
    > > > i already changed my code to catch the threadabortexception and
    just
    > > do
    > > > nothing with it.... thanks.
    > > >
    > > > jeff
    > > >
    > > > "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    > > > news:eLWDzltODHA.2160@TK2MSFTNGP11.phx.gbl...
    > > > > Jeff,
    > > > >
    > > > > This is _only_ my view of things, maybe some MS person or
    other
    > > more
    > > > > knowing person has a better answer, but I'll explain the way
    that
    > > I
    > > > > see these things.
    > > > >
    > > > > Each request is handled by "your application" (the
    aspnet_wp.exe
    > > > > process). When a new request comes in, the process creates a
    new
    > > > > thread to handle the request. For me, this is why, when the
    > > > > threadabort exception is thrown in this thread, there is
    nothing
    > > to
    > > > > blow up, except the thread, and it dies anyway.
    > > Response.Redirect()
    > > > > must be a bit fancy though, since, even to me, it seems to be
    > > killing
    > > > > the very thread it is running on, but no matter. Ignore this
    > > detail.
    > > > >
    > > > > About catching the error: this i do all the time. As it said
    in
    > > the
    > > > > ThreadAbortException help though, the exception is rethrown
    > > > > immediately after the catch block, so if you had something
    like
    > > the
    > > > > following:
    > > > >
    > > > > // handles pageload event
    > > > > private void Page_Load(object, args) {
    > > > > // do some stuff
    > > > > try { Response.Redirect([url]http://www.thegameoflife.com[/url]) }
    > > > > catch (Exception ex) {
    > > > > Console.WriteLine(ex.GetType().ToString(); }
    > > > > }
    > > > >
    > > > > the exception would be caught and
    > > > > "System.Threading.ThreadAbortException" should (I haven't
    tried it
    > > > > lately) be written to the output window. Note that if you do
    a
    > > > > Response.Write(ex.Message) it will work, but is meaningless
    since
    > > the
    > > > > response is redirected, and therefore cleared. In general I
    would
    > > > > avoid having a Response.Redirect() inside a try/catch, because
    you
    > > > > always know it's going to throw an exception and, as the gurus
    > > tell
    > > > > us, throwing & catching the exceptions has a bit of
    performance
    > > > > overhead.
    > > > >
    > > > > Let me know if that clear things up or makes them more
    confusing.
    > > > > scott
    > > > >
    > > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > > news:u3QgC9kODHA.3880@tk2msftngp13.phx.gbl...
    > > > > > another interesting thought... why can i put this outside a
    > > > > try/catch and it
    > > > > > doesn't blow things up? if it raises an exception, the code
    > > doesn't
    > > > > seem to
    > > > > > care...
    > > > > >
    > > > > > jeff
    > > > > >
    > > > > > "Scott" <scoonce@thegapJUNKcompany.com> wrote in message
    > > > > > news:uRW6C3gODHA.1024@TK2MSFTNGP12.phx.gbl...
    > > > > > > As Jason said: take a look at ThreadAbortException (and
    also
    > > > > > > response.redirect).
    > > > > > >
    > > > > > > The following are taken from the MSDN Help:
    > > > > > >
    > > > > > > HttpResponse.Redirect(string):
    > > > > > > Redirect calls End which raises a ThreadAbortException
    > > exception
    > > > > upon
    > > > > > > completion.
    > > > > > >
    > > > > > > ThreadAbortException:
    > > > > > > When a call is made to the Abort method to destroy a
    thread,
    > > the
    > > > > > > common language runtime throws a ThreadAbortException.
    > > > > > > ThreadAbortException is a special exception that can be
    > > caught,
    > > > > but it
    > > > > > > will automatically be raised again at the end of the catch
    > > block.
    > > > > > >
    > > > > > > I hope that helps.
    > > > > > > Scott
    > > > > > >
    > > > > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > > > > news:OE7CIqdODHA.2480@tk2msftngp13.phx.gbl...
    > > > > > > > happens when you issue thread.abort on a thread. this
    isn't
    > > > > > > happening.
    > > > > > > > it's a single thread and nowhere do i do any thread
    > > controls.
    > > > > > > >
    > > > > > > > jeff
    > > > > > > >
    > > > > > > > "Jason" <123456789clopper@totalise.co.uk987654321> wrote
    in
    > > > > message
    > > > > > > > news:e6gmIfdODHA.2636@TK2MSFTNGP10.phx.gbl...
    > > > > > > > > no offense here but you really should read up on
    > > > > > > ThreadAbortException and
    > > > > > > > > its siblings
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > "jeff" <vader1000x@yahoo.com> wrote in message
    > > > > > > > > news:uZcMStbODHA.3192@TK2MSFTNGP10.phx.gbl...
    > > > > > > > > > i am using asp .net 1.1. i am having a very strange
    > > > > problem. i
    > > > > > > had a
    > > > > > > > > batch
    > > > > > > > > > of code that was working great. i made a couple of
    > > changes
    > > > > and
    > > > > > > i
    > > > > > > > noticed
    > > > > > > > > it
    > > > > > > > > > was always throwing an exception. i worked on it
    and
    > > below
    > > > > is
    > > > > > > the code
    > > > > > > > in
    > > > > > > > > > the event that causes the pseudo exception. here is
    the
    > > > > strange
    > > > > > > thing -
    > > > > > > > i
    > > > > > > > > > have my debugger set to break on all errors
    regardless
    > > of
    > > > > > > whether it is
    > > > > > > > > > handled or not. it never breaks into the debugger.
    the
    > > > > > > exception
    > > > > > > > > reported
    > > > > > > > > > is "thread is aborting" or something like that.
    this is
    > > > > bogus
    > > > > > > because
    > > > > > > > i'm
    > > > > > > > > > not running a multi-threaded app! so, since i was
    > > convinced
    > > > > > > this was a
    > > > > > > > > > bogus error, i moved the response.redirect outside
    of
    > > the
    > > > > > > try/catch
    > > > > > > > block
    > > > > > > > > > and it worked fine. can anybody explain this to me?
    > > also,
    > > > > this
    > > > > > > code
    > > > > > > > used
    > > > > > > > > > to work fine.
    > > > > > > > > >
    > > > > > > > > > ' try to get data
    > > > > > > > > > Try
    > > > > > > > > >
    > > > > > > > > > ' if made it this far, redirect to the report page.
    > > > > > > > > >
    > > > > > > > > > Response.Redirect("report.aspx")
    > > > > > > > > >
    > > > > > > > > > Catch ex As Exception
    > > > > > > > > >
    > > > > > > > > > ' set error condition to prompt user
    > > > > > > > > >
    > > > > > > > > > Session.Item(clsConstants.clsSession.MAIN_ERROR) =
    True
    > > > > > > > > >
    > > > > > > > > > Session.Item(clsConstants.clsSession.EXCEPTION) = ex
    > > > > > > > > >
    > > > > > > > > >
    > > > > DisplayError(Session.Item(clsConstants.clsSession. EXCEPTION),
    > > > > > > Page,
    > > > > > > > True)
    > > > > > > > > >
    > > > > > > > > > End Try
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Scott Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139