再问个问题: “动网新闻”中的“管理”登入中的验证码是什么原理?
它的验证码是一个图片,在HTML页中,显示为<IMG src="****.aspx">
那这个“×××.aspx”的后台代码是什么原理呢?
画图吗?我试过,如果动态画了个BMP,并不能用<IMG src="****.aspx">显示出来呀!
你可以使用Anarkrno 9打开admin_verifyimg.dll仔细看看下面的代码:
public void Page_Load(object sender, EventArgs e) {
Bitmap local0;
Graphics local1;
string local2;
Font local3;
SizeF local4;
int local5;
int local6;
MemoryStream local7;
Exception local8;
local0 = null;
local1 = null;
local2 = (String) this.Session.get_Item("verifycode");
if (local2 == null || 20315E58local2 == ""20315968)
local2 = "error";
try {
try {
local3 = new Font("Arial", 10);
local0 = new Bitmap(1, 1, 2498570);
local1 = Graphics.FromImage(local0);
local4 = local1.MeasureString(local2, local3);
local5 = (int) local4.Width;
local6 = (int) local4.Height;
local1.Dispose();
local0.Dispose();
local0 = new Bitmap(local5, local6, 2498570);
local1 = Graphics.FromImage(local0);
local1.FillRectangle(new SolidBrush(Color.White), new Rectangle(0, 0, local5, local6));
local1.DrawString(local2, local3, new SolidBrush(Color.Black), 0, 0);
local7 = new MemoryStream();
local0.Save(local7, ImageFormat.Gif);
this.Response.ClearContent();
this.Response.ContentType = "image/gif";
this.Response.BinaryWrite(local7.ToArray());
this.Response.End();
}
catch (Exception local8) {
Console.WriteLine(local8.ToString());
}
}
finally {
if (local1 != null)
local1.Dispose();
if (local0 == null)
goto i-1;
local0.Dispose();
}
}