title: Top-level exception handling for (visual) web parts
body: <p>I've looked into this quite extensively and I've found the following:</p>
  
  <ol>
  <li>You can do some clever stuff to catch most errors by implementing a base class, see Andreas Knudsen's solution for this.</li>
  <li>The Error event in UserControl never gets fired, see details here: <a href="http://weblogs.asp.net/vga/archive/2003/06/16/8748.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/vga/archive/2003/06/16/8748.aspx</a></li>
  </ol>
  
  <p>What I can't find is any general way to catch errors occurring in postback events, such as the click event for a button, at the web part or user control level. What I mean by general is a something I can implement in a baseclass.</p>
  
  <p>I'm aware the I should do proper try/catch in my code, but for large teams I'd like to be sure that a web part never crashes the page, but always shows a nice message and allows execution to continue for the other web parts on the page.</p>
  
  <p>I don't think it's possible but I'd <em>love</em> to be proved wrong.</p>
  
  <p>Thanks,
  Bjoern</p>