public static ValidateSessionKey ( string sessionKey ) : void | ||
sessionKey | string | |
Результат | void |
public static void ValidateSessionKey(string sessionKey)
{
if (sessionKey == null)
{
throw new ArgumentNullException("sessionKey", "Session key cannot be null!");
}
if (sessionKey.Length != SessionKeyLength)
{
throw new ArgumentOutOfRangeException("sessionKey", "Invalid session key!");
}
if (sessionKey.Any(ch => !ValidSessionKeyChars.Contains(ch)))
{
throw new ArgumentOutOfRangeException("sessionKey", "Session key contains invalid characters!");
}
}