コード例 #1
0
            private static async Task HandleExceptionAsync(HttpContext context, Exception exception, IErrorLogger errorLogger)
            {
                string errorCode = calculateErrorCode(context.TraceIdentifier);
                string message   = string.Format("Oopss... An error on web site occurred; please contact the help desk with the following error code: '{0}'  [{1}]", errorCode, context.TraceIdentifier);

                // Log.Error(exception, message);

                context.Response.ContentType = "text/plain";
                context.Response.StatusCode  = (int)HttpStatusCode.InternalServerError;
                errorLogger.SaveErrorException(exception, context.Request.Path, message);
                await context.Response.WriteAsync(message);
            }