コード例 #1
0
        public override void Process(HttpRequestArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (Utils.UrlUtil.IsValidUrls(args.LocalPath))
            {
                return;
            }
            if (Context.Item != null)
            {
                return;
            }

            var itemNotFoundPageItemPath = this._sitecoreContext.ItemNotFoundPage;

            if (string.IsNullOrWhiteSpace(itemNotFoundPageItemPath))
            {
                return;
            }

            var pageNotFoundItem = UrlUtil.GetPageNotFoundItem(itemNotFoundPageItemPath);

            RedirectUtil.Do404Redirect(HttpContext.Current.Response, pageNotFoundItem);

            Log.Warn("The 'Not Found Page: {0} shows no content when rendered!", itemNotFoundPageItemPath);
        }