我在asp.net mvc下的網頁上使用了reCaptcha。這個網站有一個SSL認證,我和reCaptcha有問題。 這是我上查看代碼:reCaptcha和SSL網站
<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。
當我加載登記表我對歌劇此警報:
規則服務器證書的服務器名稱相匹配。你想接受嗎?
如果我接受此證書,顯示reCaptcha代碼,但如果沒有,我不會查看reCaptcha代碼。
你能幫我嗎? 如果您需要更多關於我的代碼的信息,請隨時向我詢問。
問候。
是Google的ASP.NET reCaptcha控件嗎?這只是Opera中的一個問題嗎? – Rup 2011-05-06 13:34:36
不,它會在所有網頁瀏覽器上發生。 – Pipeline 2011-05-07 17:31:27