AppMetrics.WebUtils.BasicAuthenticationModule.CreateUser C# (CSharp) Method

CreateUser() public static method

public static CreateUser ( string userName, string password ) : void
userName string
password string
return void
        public static void CreateUser(string userName, string password)
        {
            lock (Sync)
            {
                _users = null;

                var random = new Random();
                var salt = new string((char)(random.Next(char.MaxValue)), 1);
                var hashString = GetPasswordHash(salt, password);
                var saltEncoded = Convert.ToBase64String(Encoding.Unicode.GetBytes(salt));

                var newData = string.Format("{0}\t{1}\t{2}\r\n", userName, saltEncoded, hashString);
                File.AppendAllText(CredentialsFileName, newData);
            }
        }