-
-
Save islaytitans/987f45d6eac07ec003a09d1cc518d49d to your computer and use it in GitHub Desktop.
Sitecore personalization rule grant gated access condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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