AI OnAI Off
Are you using owin? any addons?
Sounds like you have a custom visitor group for roles running in your solution? Probably this implementation.
http://world.episerver.com/blogs/Magnus-Rahl/Dates/2011/1/More-custom-Visitor-Group-criteria-Role/
Might want to remove that one or bug fix it...
using System; using System.Collections.Generic; using System.Linq; using System.Web; using EPiServer.Personalization.VisitorGroups; namespace CriteriaPack.RoleCriterion { /// <summary> /// Implementation of a EPiServer.Personalization.VisitorGroups.CriterionBase /// which checks if a user is in a named role. /// </summary> [VisitorGroupCriterion( Category = "Technical Criteria", DisplayName = "Role", Description = "Criterion that matches the user's roles", LanguagePath = "Install/lang/RoleCriterion")] public class RoleCriterion : CriterionBase<RoleModel> { public override bool IsMatch(System.Security.Principal.IPrincipal principal, HttpContextBase httpContext) { bool isInRole = principal.IsInRole(Model.RoleName); bool shouldBeInRole = Model.Condition == RoleCompareCondition.Equal; return isInRole == shouldBeInRole; } } }
This is the code.
[VisitorGroupCriterion( Category = "Technical Criteria", DisplayName = "Role", Description = "Criterion that matches the user's roles", LanguagePath = "Install/lang/RoleCriterion")] public class RoleCriterion : CriterionBase<RoleModel> { public override bool IsMatch(System.Security.Principal.IPrincipal principal, HttpContextBase httpContext) { bool isInRole = principal.IsInRole(Model.RoleName); bool shouldBeInRole = Model.Condition == RoleCompareCondition.Equal; return isInRole == shouldBeInRole; } } public class RoleModel : ICriterionModel { public EPiServer.Data.Identity Id { get; set; } public ICriterionModel Copy() { var model = (RoleModel)base.MemberwiseClone(); model.Id = Identity.NewIdentity(); return model; } [DojoWidget( SelectionFactoryType = typeof(EnumSelectionFactory), LabelTranslationKey = "/shell/cms/visitorgroups/criteria/role/comparecondition", AdditionalOptions = "{ selectOnClick: true }"), Required] public RoleCompareCondition Condition { get; set; } [DojoWidget( LabelTranslationKey = "/shell/cms/visitorgroups/criteria/role/rolename", AdditionalOptions = "{ selectOnClick: true }"), Required] public string RoleName { get; set; } } /// <summary> /// Enum representing compare conditions for booleans /// </summary> public enum RoleCompareCondition { Equal, NotEqual }
I tried the following code which compiles fine...also took a look at the Criteriapack which looks similar and compiles fine. Try the same on a fresh alloy site...?
'Roles Criterion' does not implement inherited abstract member 'Criterion Base.IsMatch(IPrincipal, HttpContextBase)' Error in creating custom Add ons, and 'RoleCriterion.IsMatch(IPrincipal, HttpContextBase)': no suitable method found to overrideRoleCriterion, any idea why these errors?