Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Personalization

$
0
0

Howdy,

I am attemtping to create a custom visitor group that looks for a user agent that the web editor specifies.

My model

    public class BrowserModel : CriterionModelBase
    {
        [Required]
        public string UserAgentName { get; set; }
        public override ICriterionModel Copy()
        {
            return ShallowCopy();
        }
    }

My Criterion

[VisitorGroupCriterion(
        Category = "Custom Criteria",
        DisplayName = "User Agent",
        Description = "Criterion that matches the user agent"
    )]
    public class BrowserCriterion : CriterionBase<BrowserModel>
    {
        public override bool IsMatch(IPrincipal principal, HttpContextBase httpContext)
        {
            return httpContext.Request.UserAgent.Equals(Model.UserAgentName);
        }
    }

Pretty simple criterion, the web editor creates a new visitor group, inserts a user agaent and hits save, however upon hitting save the following error is returned:

RequestError: Unable to load /EPiServer/Cms/VisitorGroups/SaveVisitorGroup status: 500

I am unable to proced any further, does anyone have any thoughts as to what is wrong?


Viewing all articles
Browse latest Browse all 9076