随机生成5位验证码
Random random = new Random(); string code = ""; string letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; char[] arr=letters.ToCharArray(); //生成随机的5个 for(int i = 0; i < 5; i++) { int k= random.Next(0, 52); code +=arr[i]; } return code;