コード例 #1
0
        private bool ProccessBlobRequest(HttpContextBase context, out Blob blob)
        {
            blob = (Blob)null;
            IContent content = ServiceLocator.Current.GetInstance <IContentRouteHelper>().Content;

            if (content == null || !IsRoutable(content))
            {
                return(false);
            }
            if (!content.QueryDistinctAccess(AccessLevel.Read))
            {
                DefaultAccessDeniedHandler.CreateAccessDeniedDelegate()((object)this);
                return(true);
            }
            IContent assetOwner = ServiceLocator.Current.GetInstance <ContentAssetHelper>().GetAssetOwner(content.ContentLink);

            if (assetOwner != null && !assetOwner.QueryDistinctAccess(AccessLevel.Read))
            {
                DefaultAccessDeniedHandler.CreateAccessDeniedDelegate()((object)this);
                return(true);
            }
            DateTime modifiedDate = DateTime.Today;

            if (content is IChangeTrackable)
            {
                modifiedDate = ((IChangeTrackable)content).Changed;
            }
            this.SetCachePolicy(context, modifiedDate.ToUniversalTime());
            if (this.NotModifiedHandling(context, modifiedDate))
            {
                return(true);
            }
            blob = this.GetBlob(context);
            return(blob != null);
        }
コード例 #2
0
 /// <summary>
 /// Makes sure windows authentication stay persistent even on anonymous pages when user has been logged in
 /// </summary>
 private static void KeepUserLoggedOn(HttpContextBase httpContext)
 {
     if (!EPiServer.Security.FormsSettings.IsFormsAuthentication && EPiServer.Configuration.Settings.Instance.UIKeepUserLoggedOn)
     {
         if (HttpContext.Current.Request.Cookies["KeepLoggedOnUser"] != null)
         {
             if (!httpContext.User.Identity.IsAuthenticated)
             {
                 DefaultAccessDeniedHandler.CreateAccessDeniedDelegate()(null);
             }
         }
         else if (httpContext.User.Identity.IsAuthenticated)
         {
             HttpCookie keepLoggedOn = new HttpCookie("KeepLoggedOnUser", "True");
             keepLoggedOn.Path = HttpContext.Current.Request.ApplicationPath;
             HttpContext.Current.Response.Cookies.Add(keepLoggedOn);
         }
     }
 }