You would need to get the last error that occurred (programmatically) and display it in the page. You can do that like this (in Error.aspx):
protected void Page_Load(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
lblError.Text= ex.Message;
Server.ClearError();
}
Where lblError
is a Label control defined in your page just for the purpose of displaying the error messages.
See here for more details.