public void Logout() { var rq = HttpContext.Current.Request; var tokenEntry = rq.Cookies["ath454h4zod"]; var userEntry = rq.Cookies["userid"]; if (tokenEntry == null || userEntry == null) return; if (string.IsNullOrEmpty(tokenEntry.Value) || string.IsNullOrEmpty(userEntry.Value)) return; using (var tm = new SecureTokenManager("s9")) { tm.InvalidateToken(userEntry.Value, "AUTH", tokenEntry.Value); } }
void context_BeginRequest(object sender, EventArgs e) { // determine identity var rq = HttpContext.Current.Request; var tokenEntry = rq.Cookies["ath454h4zod"]; var userEntry = rq.Cookies["userid"]; if (tokenEntry == null || userEntry == null) return; if (!string.IsNullOrEmpty(tokenEntry.Value) && !string.IsNullOrEmpty(userEntry.Value)) { // verify whether anonymous or logged in member using (var tm = new SecureTokenManager("s9")) { var t = tm.GetToken(rq.Cookies["userid"].Value, "AUTH", rq.Cookies["ath454h4zod"].Value); if (t != null) // valid login status { MembershipContext.Current.Identity = t.User; if (t.IsExpirySliding) tm.SlideToken(t.Id); } } } }