protected virtual void DisplayErrorPage(IHttpContext context, Exception exception)
{
var httpException = exception as HttpException;
if (httpException != null)
{
context.Response.Reason = httpException.Code.ToString();
context.Response.Status = httpException.Code;
}
else
{
context.Response.Reason = "Internal Server Error";
context.Response.Status = HttpStatusCode.InternalServerError;
}
var args = new ErrorPageEventArgs(context) {Exception = exception};
ErrorPageRequested(this, args);
var writer = HttpFactory.Current.Get<ResponseWriter>();
if (args.IsHandled)
writer.Send(context, context.Response);
else
{
writer.SendErrorPage(context, context.Response, exception);
args.IsHandled = true;
}
}