예제 #1
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (!PageEditing.PageIsInEditMode)
     {
         Log.Debug("Starting 404 handler action filter");
         var request = filterContext.HttpContext.Request;
         filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
         int statusCode = NotFoundPageUtil.GetStatusCode(request);
         filterContext.HttpContext.Response.StatusCode = statusCode;
         filterContext.HttpContext.Response.Status     = NotFoundPageUtil.GetStatus(statusCode);
         NotFoundPageUtil.SetCurrentLanguage(filterContext.HttpContext);
         filterContext.Controller.ViewBag.Referrer    = NotFoundPageUtil.GetReferer(request);
         filterContext.Controller.ViewBag.NotFoundUrl = NotFoundPageUtil.GetUrlNotFound(request);
         filterContext.Controller.ViewBag.StatusCode  = statusCode;
     }
 }
예제 #2
0
        /// <summary>
        /// Load event for the page
        /// </summary>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            NotFoundPageUtil.HandleOnLoad(this.Page, UrlNotFound, this.Referer);
        }