Hello,
I am creating a custom error page in ASP.NET.
The code in the page load of the custom error page is as follows:
private void Page_Load(object sender, System.EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex != null)
lblExceptionMessage.Text = ex.Message;
else
lblExceptionMessage.Text = "There was no error!";
}
However when I throw an exception in the previous page ex, above, is always
null and the label lblExceptionMessage is always "There was no error!"
Does anyone have any ideas of what I might be doing wrong?
Any help would be much appreciated,
Thanks,
Colin.