我试图在我的项目中使用Captcha,但是使用以下代码获取解析器错误...努力消除它
@{MvcCaptcha registrationCaptcha = CaptchaHelper.GetRegistrationCaptcha(); }
@if (!registrationCaptcha.IsSolved)
{
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
@Html.Captcha(registrationCaptcha)
</div>
@Html.Label("Retype the code", new { @class = "col-md-4 control-label", @for = "CaptchaCode" })
<div class="col-md-8">
@Html.TextBox("CaptchaCode", null, new { @class = "form-control captchaVal" })
</div>
</div>
}
解析器错误的原因是什么?
答案 0 :(得分:0)
设法纠正它
MvcCaptcha registrationCaptcha = CaptchaHelper.GetRegistrationCaptcha();
if (!registrationCaptcha.IsSolved)
{
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
@Html.Captcha(registrationCaptcha)
</div>
@Html.Label("Retype the code",
new { @class = "col-md-4 control-label", @for = "CaptchaCode" })
<div class="col-md-8">
@Html.TextBox("CaptchaCode", null,
new { @class = "form-control captchaVal" })
</div>
</div>
}