Sdl.Web.Mvc/Controllers/PageController.cs
/// <summary>
/// Render a file not found page
/// </summary>
/// <returns>404 page or HttpException if there is none</returns>
Render a file not found page
Render a file not found page
[FormatData]
        public virtual ActionResult NotFound()
        {
            using (new Tracer())
            {
                string notFoundPageUrl = WebRequestContext.Localization.Path + "/error-404"; 
                PageModel pageModel;
                try
                {
                    pageModel = ContentProvider.GetPageModel(notFoundPageUrl, WebRequestContext.Localization);
                }
                catch (DxaItemNotFoundException ex)
                {
                    Log.Error(ex);
                    throw new HttpException(404, ex.Message);
                }
                SetupViewData(pageModel);
                PageModel model = EnrichModel(pageModel) as PageModel ?? pageModel;
                WebRequestContext.PageModel = model;
                Response.StatusCode = 404;
                return View(model.MvcData.ViewName, model);
            }
        }
[ FormatData ] public virtual ActionResult NotFound ( ) { using ( new Tracer ( ) ) { string notFoundPageUrl = WebRequestContext . Localization . Path + " " ; PageModel pageModel ; try { pageModel = ContentProvider . GetPageModel ( notFoundPageUrl , WebRequestContext . Localization ) ; } catch ( DxaItemNotFoundException ex ) { Log . Error ( ex ) ; throw new HttpException ( 404 , ex . Message ) ; } SetupViewData ( pageModel ) ; PageModel model = EnrichModel ( pageModel ) as PageModel ?? pageModel ; WebRequestContext . PageModel = model ; Response . StatusCode = 404 ; return View ( model . MvcData . ViewName , model ) ; } }
Render a file not found page
Render a file not found page
// TODO TSI-775: No need to prefix with WebRequestContext.Localization.Path here (?)
404 page or HttpException if there is none
404 page or HttpException if there is none