示例#1
0
        /// <summary>
        /// Error page for HTTP Status Code 500 (internal server error).
        /// </summary>
        //[Menu("Application Error")]
        public ActionResult Http500()
        {
            PageTitle = "Application Error";

            // Set response headers incase the user goes directly to this action
            Response.StatusCode             = 500;
            Response.TrySkipIisCustomErrors = true;

            List <string> errorIDs;

            // Get logged error ID's for current request
            if (!UserService.Session.TryGet(MvcApplication.LoggedErrorIDKey, out errorIDs))
            {
                errorIDs = new List <string>();
            }

            // Clear stored logged error ID's for current request so next request starts with no logged error ID's
            UserService.Session.Remove(MvcApplication.LoggedErrorIDKey);

            var model = new ContentViewModel()
                        .AddTitle("Application Error")
                        .AddParagraph("The server encountered an internal error and was unable to process your request. Please try again later.");

            if (errorIDs.Any())
            {
                if (errorIDs.Count == 1)
                {
                    model.BeginParagraph()
                    .AddText("Your error ID is: ")
                    .AddStrongText(errorIDs.FirstOrDefault())
                    .EndParagraph();
                }
                else
                {
                    model.AddParagraph("Your error ID's are:")
                    .BeginUnorderedList();

                    foreach (var errorID in errorIDs)
                    {
                        model.BeginListItem()
                        .AddStrongText(errorID)
                        .EndListItem();
                    }

                    model.EndUnorderedList();
                }
            }

            model.BeginParagraph()
            .AddText("For assistance, please contact the ES Help Desk on 1300 305 520 or ")
            .AddEmailLink("*****@*****.**")
            .AddText(".")
            .EndParagraph();

            model.Hidden = new[] { LayoutType.LeftHandNavigation, LayoutType.RequiredFieldsMessage };

            return(View(model));
        }