private void ValidatePermission(DynamicDetailContainer container) { DynamicContent[] detailItems = (DynamicContent[])container.DataSource; DynamicContent item = detailItems[0]; var identity = ClaimsManager.GetCurrentIdentity(); var url = Request.Url.OriginalString; var loginUrl = string.Format("~/Mxg/AuthService/SignInByHelix?ReturnUrl={0}", url.UrlDecode()); try { /*var manager = DynamicModuleManager.GetManager(); * Type contentType = TypeResolutionService * .ResolveType("Telerik.Sitefinity.DynamicTypes.Model.ResourcesProtected.ProtectedResource");*/ if (item != null) { //var det = item?.Issec.DataItem as DynamicContent; //var pressitem = manager.GetDataItem(contentType, new Guid(item.GetValue("Id").ToString())); //bool isSecgrand = pressitem.IsSecurityActionTypeGranted(SecurityActionTypes.View); bool isSecgrand = item.IsSecurityActionTypeGranted(SecurityActionTypes.View); log.InfoFormat("title is {0}-:{1}, permission:{2}, userid:{3}, isNullGuid:{4}", item.GetValue("Title"), item.GetValue("Id"), isSecgrand, identity.UserId, identity.UserId.IsNullOrEmptyGuid() ); if (isSecgrand == false) { Response.Redirect(identity.UserId.IsNullOrEmptyGuid() ? loginUrl : "~/account/not-authorized"); } } // not login & not granded } catch (Exception ex) { log.InfoFormat("exception from get dynamic:{0}- inner:{1}", ex.Message, ex.InnerException?.Message); //Response.Redirect("~/account/not-authorized"); Response.Redirect(identity.UserId.IsNullOrEmptyGuid() ? loginUrl : "~/account/not-authorized"); } }