Block ContentLink from Visitor group criterion

Vote:
 

I am writing a custom visitor group criterion. And i need contentlink to block that has the visitor group currenly is evaluating.

    public class EventViewCriterion : CriterionBase
    {
        public override bool IsMatch(IPrincipal principal, HttpContextBase httpContext)
        {
            
            // How do i get block ContentLink from here.
            return false;
        }
    }

    public class EventViewCriterionModel : CriterionModelBase
    {
        [Required, DojoWidget(SelectionFactoryType = typeof(EnumSelectionFactory))]
        public ComparisonType Condtion { get; set; }

        [Required]
        public int ViewCount { get; set; }

        public override ICriterionModel Copy()
        {
            return base.ShallowCopy();
        }
    }


Regards Øyvind

#173769
Jan 09, 2017 13:15
Vote:
 

I would look at httpContext.Request.QueryString. It should have the content id thats being evaluated. You'll need to load the content and evaluate from there.

Don't forget to keep performance in mind!

#173771
Jan 09, 2017 14:15
Vote:
 

Hi David

Thanks for your reply.

There is nothing in httpContext.Request.QueryString. If i pass something in querystring there is something. :)

/GetPersonalizedMessages/?userid=OMfddfsafsdfdsafsfdsafyjKYJ99Xx9sR_CpomGRtEenKevAUmm4c

In this case i will see the userid in querystring, nothing else

A little bit more info

I have a userdataservice that contains data about current user and most important in this case events on the blocks on the page. Block closed can be one event. Or viewed is another event.

Editors wants to make visitor groups on theese events ( lot more but right now i am working on the events).

One example can be a rule on content block viewed less than 5 times (criterion). Or block not closed (if block is a dismisable alert).

#173777
Edited, Jan 09, 2017 15:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.