For debugging it is very useful to use followed code in Global.asax:
void Application_Error(object sender, EventArgs e)
{
System.Diagnostics.Debugger.Break();
}
But if you deploy it on IIS then in case of unhandled exception the followed dialog window will be shown for current logged on user:
The solution is to remove System.Diagnostics.Debugger.Break(); from code before deploying.