You can use Application_Error event in Global.asax.cs:
protected void Application_Error(object sender, EventArgs e)
{
var exception = Server.GetLastError();
LogException(exception);
}
And after catching this exception or even posting it :)
maxnk
source
to share