Live Traffic Feed

Thursday, July 25, 2013

How to generate random string with alphanumeric in asp.net

Leave a Comment
 public string generaterandomno()
    {
 
        string aa = "1234567890qwertyuiopasdfghjklzxcvbnm";
        string R_code = "";
        Random rnd = new Random();
        for (int i = 0; i < 8; i++)
        {
            int a = rnd.Next() % (aa.ToString().Length - 1);
            R_code += aa[a];
        }

       return R_code;
    }
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment