Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sitecore personalization rule grant gated access condition
public class GrantGatedAccessCondition<T> : IntegerComparisonCondition<T> where T : RuleContext
{
protected override bool Execute(T ruleContext)
{
string cookieName = Utility.DefineCookieName();
if (HttpContext.Current.Request.Cookies[cookieName] == null)
return false;
var actualVal = HttpContext.Current.Request.Cookies[cookieName].Value;
if (String.IsNullOrEmpty(actualVal))
return false;
return true;
}
private Utility _utility;
public Utility Utility
{
get
{
if (_utility == null)
{
_utility = new Utility();
}
return _utility;
}
set { _utility = value; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.