登录验证码,比较简单
来源:互联网 发布:留学文书怎么写 知乎 编辑:程序博客网 时间:2024/06/06 06:28
html:
<table> <tr> <td align="left"> 验证码: </td> <td align="left"> <asp:TextBox ID="txtCheckNum" runat="server"></asp:TextBox> <img src="Handler.ashx" name="Pic" style="cursor: pointer" onclick="this.src='Handler.ashx'" alt="点击刷新" /> <asp:Button ID="btnSure" runat="server" Text="提交" OnClick="btnSure_Click" /> </td> </tr> </table>
ashx:
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;using System.Drawing;using System.Drawing.Imaging;using System.Web.SessionState;namespace WebApplication3{ /// <summary> /// $codebehindclassname$ 的摘要说明 /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Handler : IHttpHandler, IRequiresSessionState { public void ProcessRequest(HttpContext context) { //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); Bitmap NewBmp = new Bitmap(36, 16, PixelFormat.Format32bppArgb); Graphics g = Graphics.FromImage(NewBmp); g.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, 36, 20)); Font textFont = new Font("GB2312", 10); Rectangle rectangle = new Rectangle(0, 0, 36, 20); string ThisNum = Convert.ToString(GetNum()); context.Session["CheckNum"] = ThisNum; g.FillRectangle(new SolidBrush(Color.BurlyWood), rectangle); g.DrawString(ThisNum, textFont, new SolidBrush(Color.Blue), rectangle); NewBmp.Save(context.Response.OutputStream, ImageFormat.Jpeg); } public bool IsReusable { get { return false; } } public int GetNum() { int GiveNum; Random MyNum = new Random(); GiveNum = MyNum.Next(8999) + 1000; return GiveNum; } }}
0 0
- 登录验证码,比较简单
- servlet简单的验证码登录验证
- 登录验证代码比较
- Struts+Servlet简单实现登录验证码
- 简单登录页面使用验证码
- WEB登录页面加入简单验证码
- java实现简单的登录验证码
- 登录简单验证
- 简单的登录验证
- 简单的登录验证
- 简单的验证登录
- 简单的登录验证
- 简单的登录验证判断
- 简单的用户登录验证
- servlet&jsp简单登录验证
- jquery 简单的登录验证
- Ext做的简单登录界面(验证码刷新)
- Struts Servlet简单实现登录随机验证码
- 2013,互联网十大关键词
- C# DateTime
- iOS7与之前版本差异
- CONTAINING_RECORD宏的详细解释
- 17周项目一(3)
- 登录验证码,比较简单
- Win7 任务栏上程序名称修改问题
- Java接口中的变量和方法默认的类型<转>
- nginx 集群配置
- oracle递归排序,返回排序号函数
- C#队列,优先级,Queue类
- 重学java(二)
- JS隐藏显示左侧菜单
- C++类静态成员