<p>I have a website built in C#.NET that tends to produce a fairly steady stream of SQL timeouts from various user controls and I want to easily pop some code in to catch all unhandled exceptions and send them to something that can log them and display a friendly message to the user.</p>

<p>How do I, through minimal effort, catch all unhandled exceptions?</p>

<p><a href="https://stackoverflow.com/questions/944/unhandled-exception-handler-in-net-11">this question</a> seems to say it's impossible, but that doesn't make sense to me (and it's about .NET 1.1 in windows apps): </p>

Do you mean handling it in all threads, including ones created by third-party code? Within "known" threads just catch
```
Exception
```
at the top of the stack.