考别人的。不知道该怎么做了~!回答正确马上结帐!
我在网上看找到一个做验证图片的,但是我到做出来了,但是在验证的时候确实不知道怎么获取它图片上的值~~请高手帮忙
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing.Imaging;
using System.IO;
using System.Drawing;
public partial class image : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string tmp = RndNum(4);
HttpCookie a = new HttpCookie( "ImageV ", tmp);
Response.Cookies.Add(a);
this.ValidateCode(tmp);
}
private void ValidateCode(string VNum)
{
Bitmap Img = null;
Graphics g = null;
MemoryStream ms = null;
int gheight = VNum.Length * 12;
Img = new Bitmap(gheight, 25);
g = Graphics.FromImage(Img);
//背景颜色
g.Clear(Color.White);
//文字字体
Font f = new Font( "Arial Black ", 10);
//文字颜色
SolidBrush s = new SolidBrush(Color.Black);
g.DrawString(VNum, f, s, 3, 3);
ms = new MemoryStream();
Img.Save(ms, ImageFormat.Jpeg);
Response.ClearContent();
Response.ContentType = "image/Jpeg ";
Response.BinaryWrite(ms.ToArray());
g.Dispose();
Img.Dispose();
Response.End();
}
private string RndNum(int VcodeNum)
{
string Vchar = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p " +