using System.Text;

        System.Random rand = new Random();

        int len = rand.Next(4,4);

        char[] chars = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ".ToCharArray();

        System.Text.StringBuilder myStr = new System.Text.StringBuilder();

        for (int iCount = 0; iCount < len; iCount++)
        {

            myStr.Append(chars[rand.Next(chars.Length)]);

        }

        string text = myStr.ToString();

        // 保存验证码到 session 中以便其他模块使用

        this.Session["checkcode"] = text;

相关文章:

  • 2021-11-07
  • 2022-12-23
  • 2023-01-09
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案