private bool ValidateTicket(string encrypted) { var username = CppTokenHolder.ExtractName(encrypted); //var str = HttpContext.Current.Session[username]; //return str == null ? false : encrypted.Equals(str.ToString()); return(username != null); }
public static string GetUsernameFromCookie() { string username = null; try { HttpCookieCollection cookies = HttpContext.Current.Request.Cookies; HttpCookie cookie = cookies.Get("Token"); username = CppTokenHolder.ExtractName(cookie.Value); } catch (NullReferenceException) { } catch (Exception) { } return(username); }