【发布时间】:2011-05-06 12:12:34
【问题描述】:
我在 asp.net mvc 下的网页上使用了 reCaptcha。这个网站有一个 SSL 证书,我遇到了 reCaptcha 问题。 这是我在 View 上的代码:
<script type="text/javascript" src="https://api-secure.recaptcha.net/challenge?k=***Public key****"> </script>
<noscript>
<iframe src="https://api-secure.recaptcha.net/noscript?k=***Public key****" height="300" width="500" frameborder="0"></iframe><br />
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
</noscript>
这段代码是我在 AccountController 上的:
private bool PerformRecaptcha()
{
var validator = new RecaptchaValidator
{
PrivateKey = "**Private Key***",
RemoteIP = Request.UserHostAddress,
Response = Request.Form["recaptcha_response_field"],
Challenge = Request.Form["recaptcha_challenge_field"]
};
try
{
var validationResult = validator.Validate();
if (validationResult.ErrorMessage == "incorrect-captcha-sol")
ModelState.AddModelError("ReCaptcha", string.Format("Please retry the ReCaptcha portion again."));
return validationResult.IsValid;
}
catch (Exception e)
{
ModelState.AddModelError("ReCaptcha", "an error occured with ReCaptcha please consult documentation.");
return false;
}
}
我的库版本是 1.0.5.0。
当我加载注册表时,我在 Opera 上收到此警报:
规则服务器证书与服务器名称匹配。你要接受吗?
如果我接受此证书,则显示 reCaptcha 代码,但如果不接受,我不会查看 reCaptcha 代码。
你能帮我解决这个问题吗? 如果您需要有关我的代码的更多信息,请随时与我联系。
问候。
【问题讨论】:
-
那是 Google 的 ASP.NET reCaptcha 控件吗?这只是 Opera 中的一个问题吗?
-
不,它发生在所有网络浏览器上。
标签: c# asp.net-mvc ssl recaptcha