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");
}
原文地址:https://www.cnblogs.com/youring2/p/2997868.html