zoukankan      html  css  js  c++  java
  • asp.net注册验证码

     1 protected void Page_Load(object sender, EventArgs e)
     2    {
     3        string NumStr = null;
     4        System.Random Rad = new System.Random();
     5        int RadNum = Rad.Next(9999);
     6        if (RadNum.ToString().Length != 4)
     7        {
     8
     9            for (int i = 1; i <= 4 - RadNum.ToString().Length; i++)
    10            {
    11                NumStr += "0";
    12            }

    13            NumStr += RadNum.ToString();
    14        }

    15        else
    16        {
    17            NumStr = RadNum.ToString();
    18        }

    19        string str = NumStr;
    20        Session["verifycode"= NumStr;
    21        Bitmap image = new Bitmap(5020);
    22        Graphics g = Graphics.FromImage(image);
    23        g.Clear(Color.White);
    24        g.DrawString(str, new Font("宋体"15, System.Drawing.FontStyle.Bold), new SolidBrush(Color.CadetBlue), 00);
    25        image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
    26        Response.Cache.SetNoStore(); 
    27    }


     1string userpass = FormsAuthentication.HashPasswordForStoringInConfigFile(this.pass.Value.ToString().Trim(), "MD5");
     2        string verify = this.VerifyCode.Value.ToString().Trim();
     3
     4        if (verify != Session["verifycode"].ToString())
     5        {
     6            JScript.Alert("贴吧提示:验证码不正确!");
     7            return;
     8        }

     9        else
    10        {
  • 相关阅读:
    【日语】日语学习计划(转载)
    【日语】日语商务情景口语
    Nop常用知识点
    c#版在pc端发起微信扫码支付
    nopcommerce 常用属性验证
    @codeforces
    @codeforces
    @codeforces
    @codeforces
    @codeforces
  • 原文地址:https://www.cnblogs.com/zwl12549/p/757510.html
Copyright © 2011-2022 走看看