登陆界面验证码的编写
来源:互联网 发布:江苏广电网络电视台 编辑:程序博客网 时间:2024/06/08 06:41
建立两个web窗体,一个为:yanzhengma,一个为:yanzheng
1、yanzhengma.aspx的设计
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="yanzhengma.aspx.cs" Inherits="练习10._12.yanzhengma" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<img src="yanzheng.aspx" onclick="this.src='yanzheng.aspx?aaa=bbb'+new Date()" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</div>
</form>
</body>
</html>
2、yanzhengma.aspx.cs的设计
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 练习10._12
{
public partial class yanzhengma : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == Session["Code"].ToString())
{
Response.Write("正确");
}
else
{
Response.Write("不正确");
}
}
}
}
3、yanzheng.aspx的设计
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="yanzheng.aspx.cs" Inherits="练习10._12.yanzheng" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
4、yanzheng.aspx.cs的设计
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 练习10._12
{
public partial class yanzheng : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "image/jpeg";
using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(57, 27))
{
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
{
Random rand = new Random();
int code = rand.Next(1000, 9999);
string verCode = code.ToString();
Session["Code"] = verCode;//写一个session:Session["Code"],把随机生成的verCode存进去。
g.DrawString(verCode, new System.Drawing.Font("黑体", 19), System.Drawing.Brushes.Green, 0, 0);
bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}
}
}
- 登陆界面验证码的编写
- Android的登陆界面生成验证码
- 登陆界面的验证代码
- 登陆界面验证码实现
- 编写一个登陆界面不连接数据库验证用户
- QT中登陆界面的编写
- 纪念一下,登陆界面“11111”验证码
- 添加登陆界面,增加验证码功能。
- 添加登陆界面,增加验证码功能。
- html编写邮箱登陆界面
- 为shark的jspClient增加一个带验证码的登陆界面
- 登陆界面(jsp)客户端验证
- 登陆时的验证码设计、及点击刷新的编写方式
- 有验证码的登陆界面(ajax,ashx技术制作)
- 有验证码的登陆界面(ajax,ashx技术制作)
- qt 登陆界面账号和密码的验证
- 验证码的编写
- 验证码的编写
- 【转】LINUX内核编译步骤详细介绍
- 加密算法总结
- IT 男 到底有多“男” 多悲催 谁能懂?!
- C++编程的精品文章整理
- 背包问题应用
- 登陆界面验证码的编写
- erlang实现的一个echo服务器
- “ 装逼不成,被雷劈了。。。。 ”答案
- 2012.10.20 百度笔试 及 一面, 二面, 第二次二面(三面)
- Android 返回键实现home键的功能
- Ubuntu 12.04_64 Chromium安装FlashPlayer插件
- 美团网 笔试
- 用引用返回值(转)
- C#--第八周实验--任务8--使用移位运算来避免乘法运算。