How to handle and **display** page level exceptions in ASP.Net Webform
<p>I'd like to use the Error event of an ASPX page to catch any unhandled exceptions that occur in that page and set the text of a label control to display the error to the user (I realize this is likely not a recommended best practice, this is a quick and dirty).</p>

<p>So, in the error event, I would have something like:</p>

<pre><code>Me.lblError.Text = Server.GetLastError.Message
</code></pre>

<p>However, when I run this and the error occurs, I can see this line is executing by setting a breakpoint, but the screen always ends up blank.  I have tried with and without a Server.ClearError after setting the text, but the result is the same.</p>

<p>Shouldn't this be possible??</p>

<h2>Update</h2>

<p>See correct answer below, as well as this article:<br />
<a href="http://msdn.microsoft.com/en-us/library/ed577840.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ed577840.aspx</a></p>
