I have a custom error that displays ok but i also wanted to send a detailed email to the site admin informing them of the error.

I've found several examples that seem to do this by setting
VB Code:
  1. <customErrors mode="On" defaultRedirect="errorpage.aspx" />
In the web.config file.

From this i can get the path for the file that caused the error as such
VB Code:
  1. Dim ErrorUrl As String = Request.Params("aspxerrorpath").ToString
I'd also like to get more detailed information though which i've tried doing as specified in the many samples i've found
VB Code:
  1. Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
  2.         ' Fires when an error occurs
  3.         Dim objError As Exception = Server.GetLastError()
  4.         HttpContext.Current.Application.Add("lastException", objError)
  5.         Server.ClearError()
  6.     End Sub
The idea then being to build up the body of the email to send with the path of the error and a detailed description of it. But i don't seem to be able to get both events to fire as if i have code in the application_error event then the user doesn't get redirected to the errorpage.

Any idea's whats going wrong/on?