Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Getting an exception in a Custom Error Page


Message #1 by Colin Angus Mackay <colin.angus.mackay@d...> on Mon, 27 Jan 2003 15:40:41 +0000
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.




  Return to Index