验证码接收

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using CZBK.ItcastProject.Common;
  6.  
  7. namespace CZBK.ItcastProject.WebApp._2015_5_29
  8. {
  9. /// <summary>
  10. /// ValidateImageCode 的摘要说明
  11. /// </summary>
  12. public class ValidateImageCode : IHttpHandler
  13. {
  14.  
  15. public void ProcessRequest(HttpContext context)
  16. {
  17. context.Response.ContentType = "text/plain";
  18. ValidateCode validatecode = new ValidateCode();
  19. string code= validatecode.CreateValidateCode();
  20. validatecode.CreateValidateGraphic(code, context);
  21. }
  22.  
  23. public bool IsReusable
  24. {
  25. get
  26. {
  27. return false;
  28. }
  29. }
  30. }
  31. }

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

  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title></title>
  6. <script type="text/javascript">
  7. window.onload = function () {
  8. var validateCode = document.getElementById("validateCode");
  9. validateCode.onclick = function () {
  10. document.getElementById("imgCode").src = "ValidateImageCode.ashx?d=" + new Date().getMilliseconds();
  11. }
  12. }
  13. </script>
  14. </head>
  15. <body>
  16. <form method="post" action="UserLogin.ashx">
  17. 用户名:<input type="text" name="txtName" /><br />
  18. 密码:<input type="password" name="txtPwd" /><br />
  19. 验证码:<input type="text" name="txtCode" /><img src="ValidateImageCode.ashx" id="imgCode" />
  20. <a href="javascript:void(0)" id="validateCode">看不清</a><br />
  21. <input type="submit" value="登录" />
  22. </form>
  23. </body>
  24. </html>

Common工具类的验证码类的使用(未实现验证)的更多相关文章

  1. pdo文字水印类,验证码类,缩略图类,logo类

    文字水印类 image.class.php <?php /** * webrx.cn qq:7031633 * @author webrx * @copyright copyright (c) ...

  2. PHP常用类------生成验证码类Code

    直接附上代码吧!很简单的代码,写一遍基本就会了,主要明白用GD库画图的几个步骤: 1.先创建画布,不然画在哪儿?(imagecreatetruecolor)2.根据要画的数据,选定颜色 (imagec ...

  3. ThinkPHP 3.2.3 加减乘法验证码类

    ThinkPHP 3.2.3 自带的验证码类位于 /ThinkPHP/Library/Think/Verify.class.php,字体文件位于 /ThinkPHP/Library/Think/Ver ...

  4. C#工具:加密解密帮助类

    using System; using System.IO; using System.Security.Cryptography; using System.Text; //加密字符串,注意strE ...

  5. mongoDB工具类以及测试类【java】

    java操作mongo工具类 package Utils; import com.mongodb.MongoClient; import com.mongodb.MongoCredential; im ...

  6. 完整验证码类(validityHelper)(代码+使用)

    using System; using System.Web; using System.Drawing; using System.Security.Cryptography; namespace ...

  7. Gif验证码类

    package com.paic.bics.common.utils.vcode; import java.awt.AlphaComposite; import java.awt.Color; imp ...

  8. PHP-解析验证码类--学习笔记

    1.开始 在 网上看到使用PHP写的ValidateCode生成验证码码类,感觉不错,特拿来分析学习一下. 2.类图 3.验证码类部分代码 3.1  定义变量 //随机因子 private $char ...

  9. THINKPHP源码学习--------验证码类

    TP3.2验证码类的理解 今天在学习中用到了THINKPHP验证码,为了了解究竟,就开始阅读TP验证码的源码. 源码位置:./ThinkPHP/Library/Think/Verify.class.p ...

随机推荐

  1. HTML5 progress元素的样式控制、兼容与实例

    一.progress元素基本了解 基本UIprogress元素属于HTML5家族,指进度条.IE10+以及其他靠谱浏览器都支持.如下简单code: <progress>o(︶︿︶)o< ...

  2. socat : Some useful commands

    http://technostuff.blogspot.com/2008/10/some-useful-socat-commands.html MONDAY, OCTOBER 6, 2008 Some ...

  3. Educational Codeforces Round 7 A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...

  4. 说说C#静态变量的诡异与恶心

    发现一段很诡异的C#代码,见识了静态构造函数这种奇怪的东西: using System; namespace StaticTest { class A { public static int X; s ...

  5. linux C高手成长过程---书籍推荐

    建议学习路径: 首先先学学编辑器,vim, emacs什么的都行. 然后学make file文件,只要知道一点就行,这样就可以准备编程序了. 然后看看<C程序设计语言>K&R,这样 ...

  6. js实现按回车自行提交

    <script type="text/javascript"> document.onkeydown = function (e) { var theEvent = w ...

  7. Linux的内存回收和交换

    Linux的内存回收和交换 版权声明: 本文章内容在非商业使用前提下可无需授权任意转载.发布. 转载.发布请务必注明作者和其微博.微信公众号地址,以便读者询问问题和甄误反馈,共同进步. 微博ID:or ...

  8. iOS iphone5屏幕适配 autosizing

    转自:http://blog.sina.com.cn/s/blog_a843a8850101jxhh.html iphone5出来了,从不用适配的我们也要像android一样适配不同分辨率的屏幕了. ...

  9. Linux服务器集群系统(一)--转

    引用地址:http://www.linuxvirtualserver.org/zh/lvs1.html LVS项目介绍 章文嵩 (wensong@linux-vs.org)2002 年 3 月 本文介 ...

  10. MeepoPS——轻量级 Socket 服务

    MeepoPS是Meepo PHP Socket的缩写.旨在提供高效稳定的由纯PHP开发的多进程SocketService. MeepoPS可以轻松构建在线实时聊天,即时游戏,视频流媒体播放,RPC, ...