internal static readonly char[] chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
internal static string GetUniqueKey(int size)
{
var data = new byte[4 * size];
new RNGCryptoServiceProvider().GetBytes(data);
var result = new StringBuilder(size);
for (var i = 0; i < size; i++)
{
var rnd = BitConverter.ToUInt32(data, i * 4);
var idx = rnd % chars.Length;
result.Append(chars[idx]);
}
return result.ToString();
}