zoukankan      html  css  js  c++  java
  • Common工具类的验证码类的使用(未实现验证)

    验证码接收

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using CZBK.ItcastProject.Common;
    
    namespace CZBK.ItcastProject.WebApp._2015_5_29
    {
        /// <summary>
        /// ValidateImageCode 的摘要说明
        /// </summary>
        public class ValidateImageCode : IHttpHandler
        {
    
            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/plain";
                ValidateCode validatecode = new ValidateCode();
                string code= validatecode.CreateValidateCode(4);
                validatecode.CreateValidateGraphic(code, context);
            }
    
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }

    登录页面(实现验证码点击替换)

    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <script type="text/javascript">
            window.onload = function () {
                var validateCode = document.getElementById("validateCode");
                validateCode.onclick = function () {
                    document.getElementById("imgCode").src = "ValidateImageCode.ashx?d=" + new Date().getMilliseconds();
                }
            }
        </script>
    </head>
    <body>
        <form method="post" action="UserLogin.ashx">
            用户名:<input type="text" name="txtName" /><br />
            密码:<input type="password" name="txtPwd" /><br />
            验证码:<input type="text" name="txtCode" /><img src="ValidateImageCode.ashx" id="imgCode" />
            <a href="javascript:void(0)" id="validateCode">看不清</a><br />
            <input type="submit" value="登录" />
        </form>
    </body>
    </html>
  • 相关阅读:
    Homebrew简介和基本使用
    在Mac OSX上配置Appium+Android自动化测试环境
    Python Selenium 常用方法总结(不断补充)
    python 分享一个通过 (key1.key2.key3) 形式获取嵌套字典值的方法
    python操作MongoDB
    webpack2.0学习
    node+webpack环境搭建 vue.js 2.0 基础学习笔记
    前端之路
    swiper组件实现向上翻页时缩小
    sass的视频教程
  • 原文地址:https://www.cnblogs.com/wyt007/p/6101053.html
Copyright © 2011-2022 走看看