Following code will be supported in lower VS, less than VS 2019:
void Application_Error(object sender, EventArgs e)
{
var _logger = LogManager.GetCurrentClassLogger();
var ex = HttpContext.Current.Server.GetLastError();
if (ex is HttpException)
{
if ((ex as HttpException).GetHttpCode() != 404)
{
_logger.Fatal(ex, ex == null ? "" : ex.Message);
}
}
else
{
_logger.Fatal(ex, ex == null ? "" : ex.Message);
}
}
Posted On:
25-Jul-2020 05:08