0

I've been researching the problem regarding Response.Redirect throwing a ThreadAbortException. One part of it in which I can't find an answer is why does this happen in VS 2013 and not in VS 2010? I can open and run the same project in each and the Response.Redirect calls only throw the exception when run in VS 2013. Thanks for any responses.

Kevin

Dave Zych
  • 21,581
  • 7
  • 51
  • 66
  • can you show the code in question where this is happening.. this could also happen on the `Page_Load` event just because you are calling `Redirect` keep in mind that before redirect.. it will hit the calling pages `Page_Load` event provided there are not validation error or java script errors or error in general..then it will redirect from that point... I know this from experience because it took me 1 hour one time to figure this out when working with Ajax stuff – MethodMan Oct 17 '14 at 19:48
  • 2
    Given the same project and same C# and .NET versions it should run the same in both environments. My assumption is that changes to the VS2013 debugger allow it to catch the exception in a way that VS2010 can't. Again, this is an assumption and I have no proof of this. – Dave Zych Oct 17 '14 at 19:51
  • Thanks. I get the same behavior on most (if not all) of the Response.Redirect calls in the app. I don't see the point to providing source code, I can't give you all the code leading up to the calls and without that, there would be no context. This behavior makes me think its some setting somewhere or VS 2013 using a later version of something. It could just be reporting but I can trace through the calls in 2010 and there is no exception thrown. – user3473870 Oct 17 '14 at 20:01
  • While debugging in VS2010, look in the `Output` window after calling `Response.Redirect` - you should see `A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll` or similar, which further proves my theory that it's being thrown but isn't handled by the debugger. – Dave Zych Oct 17 '14 at 20:04
  • Great suggestion and yes it does occur. So that makes me wonder why our production site isn't bombing on these errors. I've been assuming it isn't being thrown there but now I'm not so sure. I'll have to do some more research on that. – user3473870 Oct 17 '14 at 20:53
  • It does happen in VS2010. It's not going to bomb your site, though you can and should get rid of them. I explain a little [in this SO answer](http://stackoverflow.com/questions/13727422/can-endresponse-increase-performance-of-asp-net-page/13727769#13727769). – MikeSmithDev Oct 18 '14 at 00:49

0 Answers0