var byteArray = Encoding.ASCII.GetBytes($"{UserName}:{Password}"); string encodeString = Convert.ToBase64String(byteArray);