usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
usingSystem.Drawing;
usingSystem.Drawing.Drawing2D;
usingSystem.Drawing.Imaging;
publicpartialclassmy_ValidateImage:System.Web.UI.Page
...{
privatereadonlystringImagePath="../images/Validator.jpg";
privatestaticstringsValidator="";
protectedvoidPage_Load(objectsender,EventArgse)
...{
if(Request.Params["Validator"]!=null)
...{
sValidator=Request.Params["validator"].ToString();
}
BitmapbitMapImage=newSystem.Drawing.Bitmap(Server.MapPath(ImagePath));
GraphicsgraphicImage=Graphics.FromImage(bitMapImage);
graphicImage.SmoothingMode=SmoothingMode.AntiAlias;
graphicImage.DrawString(sValidator,newFont("Arial",20,FontStyle.Bold),SystemBrushes.WindowText,newPoint(0,0));
Response.ContentType="image/jpeg";
//bitMapImage.sava(Response.OutputStream,ImageFormat.Jpeg);
bitMapImage.Save(Response.OutputStream,ImageFormat.Jpeg);
graphicImage.Dispose();
bitMapImage.Dispose();
}
}
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
publicpartialclassmy_Default:System.Web.UI.Page
...{
staticstringsValidator="134";
privatereadonlystringsValidatorImageUrl="ValidateImage.aspx?Validator=";
protectedvoidPage_Load(objectsender,EventArgse)
...{
if(!Page.IsPostBack)
...{
Randomr=newRandom(10);
sValidator=r.Next().ToString();
//sValidator=GetRandomint();
//sValidator="456789";
//sValidator=GetRandomint();
//sValidator=GetRandomint();
//sValidator=Getrandomint();
//validateimage.ImageUrl=svalidatorImageUrl+svalidator;
//ValidateImage.ImageUrl=sValidatorImageUrl+sValidator;
ValidateImage.ImageUrl=sValidatorImageUrl+sValidator;
//ValidateImage.ImageUrl="../images/index1.jpg";
}
}
privatestringGetRandomint()
...{
thrownewException("Themethodoroperationisnotimplemented.");
}
privatestringGetrandomint()
...{
thrownewException("Themethodoroperationisnotimplemented.");
}
protectedvoidButton1_Click(objectsender,EventArgse)
...{
inta=0;
if(a<1)
...{
//Response.Write("<script>window.alert('"asdkfkasd"')</script>");
//Response.Write("<script>alert("li")</script>");
return;
}
Response.Redirect("~/default.htm");
}
}
每次产生的验证码过程,继续处理中。。。。。。。。
确保产生的验证码介于(10000,999999)之间
sValidator = r.Next(100000,999999).ToString();
分享到:
相关推荐
验证码程序验证码程序验证码程序验证码程序
ASP中文验证码程序ASP中文验证码程序ASP中文验证码程序
一个验证码程序,附带了一个模块,是一个皮肤模块,如果不喜欢可以去掉!
Java验证码程序。 public class CheckImage extends HttpServlet==
bmp简单验证码程序.cpp 简单验证码是指验证码图片里的字符,固定不变,或者变化很小的验证码,比如:字符上会有一些干扰点干扰线等情况,或者只有少数几种字体变化和字体大小变化。 这里给出源代码都是非常简单的...
java版本破解新浪验证码程序java版本破解新浪验证码程序
名称:验证码程序 简介:一个普通的登录验证码程序,通过按钮"换一张"切换验证码,并自动生成文件保存在本地。 原理:通过MFC绘图技术实现,绘画文字和线条,实现简单的验证码。
网上流传的都是数字或字母的,很容易被破解,而且现在已经有许多数字及代码的验证码识别软件,但汉字的还很少见。此代码程序纯asp,无需组件,使用方便,可以让你的网站更安全。
discuzx2.5 防注册机 验证码 程序
ASP图片验证码程序
ASP.NET验证码程序,可以生成图片,也可以直接显示文本,含调用实例
php汉字验证码程序,很好的!~~~~~~~~~
非常好用的验证码程序 非常好用的验证码程序 非常好用的验证码程序
JSP生成彩色验证码程序
简单的验证码程序,基于javaee的两个程序
用Win32实现的简易的验证码程序 http://blog.csdn.net/crocodile__/article/details/9612189 (主要用于博文资源下载)
JSP生成数字验证码程序例子