Does the personalization IPAddress characteristic support wildcards?
We need to have a segment for users in certain buildings\ip ranges...the verbage in the UI is
"IP Address is(or is not) X"...no contains or anything
Any idea?
No it does not.
That being said, it's rather trivial to make it so. Create a new class, let's say AwesomeIpEvaluator and have it implement ICriterionEvaluator. Implement the interface... the trick is in the IsMatch function - the first argument "settings" is what user entered in the UI, so that could be one or more IP addresses. Do some RegEx magic and return true if it's a match, otherwise false.
Finally, you need to replace the default IpAddressEvaluator. You can do this through DI, like this:
ObjectFactory.Container.RegisterType(
typeof
(ICriterionEvaluator),
typeof
(AwesomeIpEvalutator),
// your new evaluator
PersonalizationConstants.CriteriaName.IPAddress,
// name of the evaluator
new
ContainerControlledLifetimeManager(),
new
InjectionConstructor());
Trivial indeed, and great evaluator name :)