I want to write custom errors and unexpected errors via Global.asax.
In that method I use : var ex = Server.GetLastError();
to obtain the error which ocurred.
However, this code is not hit (or fired) when I set web.config to ErrorMode RemoteOnly. It only works when it's set to Off.
Why is this?
try
{
var sd = db.GetDetails().Single();
}
catch (Exception ex)
{
//some function here followed by a throw.
throw;
}