BVNetwork.NotFound.Core.NotFoundPage.NotFoundPageUtil.SetCurrentLanguage C# (CSharp) Method

SetCurrentLanguage() public static method

public static SetCurrentLanguage ( System.Web.HttpContextBase context ) : void
context System.Web.HttpContextBase
return void
        public static void SetCurrentLanguage(HttpContextBase context)
        {
            Uri urlNotFound = new Uri(SiteDefinition.Current.SiteUrl + GetUrlNotFound(context.Request));
            SetCurrentLanguage(urlNotFound.ToString());
        }

Same methods

NotFoundPageUtil::SetCurrentLanguage ( string url ) : void

Usage Example

Esempio n. 1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (PageEditing.PageIsInEditMode)
            {
                return;
            }

            Logger.Debug("Starting 404 handler action filter");
            var request = filterContext.HttpContext.Request;

            filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
            var statusCode = NotFoundPageUtil.GetStatusCode(request);

            filterContext.HttpContext.Response.StatusCode = statusCode;
            var status = NotFoundPageUtil.GetStatus(statusCode);

            if (!string.IsNullOrEmpty(status))
            {
                filterContext.HttpContext.Response.Status = status;
            }
            NotFoundPageUtil.SetCurrentLanguage(filterContext.HttpContext);
            filterContext.Controller.ViewBag.Referrer    = NotFoundPageUtil.GetReferer(request);
            filterContext.Controller.ViewBag.NotFoundUrl = NotFoundPageUtil.GetUrlNotFound(request);
            filterContext.Controller.ViewBag.StatusCode  = statusCode;
        }