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        {
  • 相关阅读:
    mysql 按出现次数排序
    拼接sql
    java 操作 excel
    jQuery ui 利用 datepicker插件实现开始日期(minDate)和结束日期(maxDate)
    android压力测试命令monkey详解
    java css
    iss 默认上传大小为30 M
    PHP自动生成后台导航网址的最佳方法
    PHP 文件上传的综合实例
    php字符串首字母转换大小写的实例
  • 原文地址:https://www.cnblogs.com/zwl12549/p/757510.html
Copyright © 2011-2022 走看看