public string GetAdditionalData(HttpContext context) { var token = TokenGenerator.GetRandomToken(); context.Session.SetString(TokenKey, token); return(token); }
public string GetAdditionalData(HttpContext context) { var newToken = TokenGenerator.GetRandomToken(); if (newToken.Contains(Separator)) { newToken = newToken.Replace(Separator.ToString(), string.Empty); //to prevent collision } List <string> existingTokens = GetTokens(context); if (existingTokens.Count == AmountOfSessionTokens) { existingTokens.RemoveAt(0); } existingTokens.Add(newToken); SetTokens(context, existingTokens); return(newToken); }