首页 > Windows开发 > 详细

C#解决验证码问题

时间:2016-06-30 12:44:36      阅读:283      评论:0      收藏:0      [点我收藏+]

            string ss = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
            Random a = new Random();
            int b;
            string yan = "";
            for (int i = 0; i < 4; i++)
            {
                b = a.Next(62);
                yan += ss.Substring(b, 1);
            }
            Console.WriteLine("验证码是:" + yan);
            Console.Write("请输入验证码:");
            string c = Console.ReadLine();
            if (c.ToUpper() == yan.ToUpper())
            {
                Console.WriteLine("验证码正确!");
            }
            else
            {
                Console.WriteLine("验证码错误!");
            }
            Console.ReadLine();

C#解决验证码问题

原文:http://www.cnblogs.com/H2921306656/p/5629536.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!