MvcCaptcha 帮助文档 — MvcCaptcha 扩展方法

该方法用于生成验证图片及加载验证码图片相关的客户端脚本。

重载列表

public static string MvcCaptcha(this HtmlHelper helper);

public static string MvcCaptcha(this HtmlHelper helper, MvcCaptchaOptions options)

示例

    <%Html.BeginForm(); %>
    <%=Html.MvcCaptcha(new MvcCaptchaOptions {DelayLoad=true, ValidationInputBoxId = "_mvcCaptchaText", CaptchaImageContainerId = "captchaImage" })%>
    <span id="captchaImage"></span>
    请输入上边图片中的文字:
    <input type="text" name="_mvcCaptchaText" id="_mvcCaptchaText" /><input type="submit" value="提交" />
    <%Html.EndForm(); %>