WebPage中使用验证码
我在这篇文章中转载了一个验证码生成的方法:http://www.cnblogs.com/youring2/archive/2013/04/03/2997859.html
要在WebPage中使用(MVC也适用),看下面的代码:
@{
ValidateCode vCode = new ValidateCode();
string code = vCode.CreateValidateCode(5);
Session["ValidateCode"] = code;
byte[] bytes = vCode.CreateValidateGraphic(code);
Response.WriteBinary(bytes, "image/jpeg");
}

浙公网安备 33010602011771号