public override void OnException(ExceptionContext filterContext)
 {
     if (filterContext.HttpContext.IsCustomErrorEnabled)
     {
         System.Exception   ex       = filterContext.Exception;
         TempDataDictionary tempdata = filterContext.Controller.TempData;
         if (ex is System.Security.SecurityException)
         {
             tempdata["Error"] = "Access denied. Please contact IT or your manager if you need access.";
         }
         if (RapidHandleErrorAttribute.sessionHasExpired(filterContext))
         {
             tempdata["Error"] = "Your session has expired.";
         }
         if (tempdata["Error"] != null)
         {
             base.OnException(filterContext);
             return;
         }
         RapidLogger.Error(ex, "Error in page " + filterContext.HttpContext.Request.RawUrl);
         tempdata["Error"] = "An unexpected system error has occurred. ";
         TempDataDictionary tempDataDictionary;
         (tempDataDictionary = tempdata)["Error"] = tempDataDictionary["Error"] + "The error has been logged. Please try again or contact the Help Desk if the problem persists.";
         if (ex is HttpRequestValidationException && ex.Message.StartsWith("A potentially dangerous"))
         {
             tempdata["Error"] = "The application has deemed one of your entries as potentially dangerous. Please review your entires and make sure they do not contain '<' character.";
         }
         if (ex.Message.Contains("timed out"))
         {
             tempdata["Error"] = "Your request has timed out. Please try again later or contact the Help Desk if the problem persists.";
         }
     }
     base.OnException(filterContext);
 }
예제 #2
0
        internal static void TraceRegistrations(IUnityContainer container)
        {
#if DEBUG
            foreach (var registration in container.Registrations.OrderBy(x => x.RegisteredType.FullName))
            {
                RapidLogger.Trace("Unity Registrations",
                                  string.Format("{0} => {1} using {2}",
                                                registration.RegisteredType.FullName,
                                                registration.MappedToType.FullName,
                                                registration.LifetimeManagerType.Name
                                                )
                                  );
            }
#endif
        }