コード例 #1
0
        public override void Process(HttpRequestArgs args)
        {
            if (AbortProcessor(args))
            {
                return;
            }

            var notFoundItem = _errorItemResolver.GetNotFoundItem();

            if (notFoundItem == null)
            {
                return;
            }

            var layoutFilePath = notFoundItem.Visualization?.Layout?.FilePath;

            if (string.IsNullOrEmpty(layoutFilePath))
            {
                return;
            }

            _context.Item                = notFoundItem;
            _context.Page.FilePath       = layoutFilePath;
            _context.Items["httpStatus"] = (int)HttpStatusCode.NotFound;
            _context.Items[SitecoreExtensionsConstants.CustomContextItemKey] = true;
            args.HttpContext.Response.TrySkipIisCustomErrors = true;
        }
コード例 #2
0
        private string GetNotFoundUrl()
        {
            var notFoundItem = _errorItemResolver.GetNotFoundItem();

            if (notFoundItem == null)
            {
                return(null);
            }

            var baseUrl     = GetItemUrl(notFoundItem);
            var queryString = GetStatusCodeQueryString();

            return(WebUtil.AddQueryString(baseUrl, queryString));
        }