Code for creating Key using Random numbers and alphabets.
You Can Find RNGCryptoServiceProvider class in below namespace. System.Security.Cryptography; public static string CreateKey(int length)
{
byte[] random = new byte[length / 2];
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
rng.GetBytes(random);
StringBuilder Key = new StringBuilder(length);
for (int i = 0; i < random.Length; i++)
Key.Append(String.Format("{0:X2}", random[i]));
return Key.ToString();
}