Skip to content

Instantly share code, notes, and snippets.

@irobinson
Created December 31, 2010 06:50
Show Gist options
  • Save irobinson/760800 to your computer and use it in GitHub Desktop.
Save irobinson/760800 to your computer and use it in GitHub Desktop.
proof in concept logic for user authentication verification based on DNN cookie.
private bool CheckAuthenticationCookie()
{
var cookie = this.Context.Request.Cookies[FormsAuthentication.FormsCookieName];
if (!this.Context.Request.IsAuthenticated || cookie == null)
{
return false;
}
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
string username = ticket.Name;
int portalId = PortalController.GetCurrentPortalSettings().PortalId;
var user = UserController.GetCachedUser(portalId, username);
return user != null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment