asp.net验证码
protected void Page_Load(object sender, EventArgs e)
{
Response.BufferOutput = true;
Bitmap img = new Bitmap(100, 100, PixelFormat.Format24bppRgb);
Graphics grh = Graphics.FromImage(img);
grh.Clear(ColorTranslator.FromHtml("#336699"));
grh.FillRectangle(new SolidBrush(Color.Yellow), 200, 200, 200, 200);
grh.DrawString(Show(), new Font("宋体", 20), new SolidBrush(Color.Red), new PointF(50, 50));
//Response.ContentType = "image/Jpeg";
img.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.ContentType = "image/Jpeg";
grh.Dispose();
img.Dispose();
Response.End();
}
protected string Show()
{
string str = "";
Random ran = new Random();
for (int i = 0; i < 4; i++)
{
str += ran.Next(1,10);
}
return str;
}
以上是我做的一个验证码测试
可是页面上面的控件 都不显示了 怎么解决
还有这个验证码一出来就上最上面 怎样把这个验证码定位呢 点击看不清换一张 验证码也会变动
{
Response.BufferOutput = true;
Bitmap img = new Bitmap(100, 100, PixelFormat.Format24bppRgb);
Graphics grh = Graphics.FromImage(img);
grh.Clear(ColorTranslator.FromHtml("#336699"));
grh.FillRectangle(new SolidBrush(Color.Yellow), 200, 200, 200, 200);
grh.DrawString(Show(), new Font("宋体", 20), new SolidBrush(Color.Red), new PointF(50, 50));
//Response.ContentType = "image/Jpeg";
img.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.ContentType = "image/Jpeg";
grh.Dispose();
img.Dispose();
Response.End();
}
protected string Show()
{
string str = "";
Random ran = new Random();
for (int i = 0; i < 4; i++)
{
str += ran.Next(1,10);
}
return str;
}
以上是我做的一个验证码测试
可是页面上面的控件 都不显示了 怎么解决
还有这个验证码一出来就上最上面 怎样把这个验证码定位呢 点击看不清换一张 验证码也会变动
...全文
相关推荐
ASP.NET验证码 ASP.NET验证码
ASP.NET验证码 ASP.NET验证码 ASP.NET验证码 ASP.NET验证码 ASP.NET验证码 ASP.NET验证码
ASP.NET验证码的生成
新建一个类用来创建验证码代码如下: using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.T...
ASP.NET MVC实现网站验证码功能
ASP.NET MVC实现网站图片验证码功能,有源代码,与案例文档
ASP.net压缩ViewState,ASP.net操作EXCEL,Word,ASP.net获得验证码,汉字验证码、扭曲验证码
ASP.net压缩ViewState,ASP.net操作EXCEL,Word,ASP.net获得验证码,汉字验证码、扭曲验证码
asp.net 验证码
asp.net c# 验证码 实例,vs2005直接打开即可 http://www.dotnetdev.cn


