ASP.NET Custome Error Page
<system.web>
<customErrors mode="On" defaultRedirect="UI/ErrorPage.aspx" redirectMode="ResponseRewrite"/>
</system.web>
protected void Page_Load(object sender, EventArgs e)
{
try
{
HttpContext ctx = HttpContext.Current;
Exception exception = ctx.Server.GetLastError();
string errorInfo =
"<br>Offending URL: " + ctx.Request.Url.ToString() +
"<br>Source: " + exception.Source +
"<br> <b> Message: " + exception.Message + "</b>" +
"<br>Stack trace: " + exception.StackTrace;
lblMsg.Text = errorInfo;
}
catch (Exception ex)
{
}
}