Skip to content

Instantly share code, notes, and snippets.

@islaytitans
Last active June 30, 2016 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save islaytitans/d36c3c5dbe187884812598e90b641391 to your computer and use it in GitHub Desktop.
Save islaytitans/d36c3c5dbe187884812598e90b641391 to your computer and use it in GitHub Desktop.
Grant access to gated content Sitecore webforms for marketers
public class GrantGatedAccess : WffmSaveAction
{
public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null,
params object[] data)
{
HttpCookie cookie = new HttpCookie(Constants.GatedAccessCookeName)
{
Value = Constants.AccessGrantedCookieValue,
Expires = DateTime.Now.AddDays(Utility.GetCookieLifeSpan())
};
HttpContext.Current.Response.Cookies.Add(cookie);
}
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