我们已经开始使用 ASP.NET recaptcha 控件,它运行良好。但我们的要求之一是所有出站流量都通过 HTTPS。
我知道 recaptcha 支持 https,但不清楚在使用 ASP.NET 插件选项时如何配置(或者即使它是可配置的)。
有人有这方面的经验吗?
我将扩展一下我迄今为止所发现的内容......
Recaptcha包包含3个公共类
RecaptchaControl,
RecaptchaValidator
and
RecaptchaResponse
RecaptchaControl
是一个 Asp.NET 控件,那里的 recaptcha 特定方法似乎与主题/外观和感觉有关。
验证器的实例有一个 RemoteIP 字段(我认为它代表验证服务器),但我无法将其绑定到控件。
RecaptchaResponse
似乎或多或少代表了一个具有可能响应的枚举(有效/无效/连接失败)。
看起来Recaptcha控件智能选择https如果请求是 https。
我假设它对验证执行相同的操作,但从源代码中尚不清楚http://code.google.com/p/recaptcha/source/browse/trunk/recaptcha-plugins/dotnet/library/
private const string VerifyUrl = "http://www.google.com/recaptcha/api/verify";
private const string RECAPTCHA_SECURE_HOST = "https://api-secure.recaptcha.net";
private const string RECAPTCHA_HOST = "http://api.recaptcha.net";
--------------------------------SNIP------------------------------------
/// <summary>
/// This function generates challenge URL.
/// </summary>
private string GenerateChallengeUrl(bool noScript)
{
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.Append(Context.Request.IsSecureConnection || this.overrideSecureMode ? RECAPTCHA_SECURE_HOST : RECAPTCHA_HOST);
urlBuilder.Append(noScript ? "/noscript?" : "/challenge?");
urlBuilder.AppendFormat("k={0}", this.PublicKey);
if (this.recaptchaResponse != null && this.recaptchaResponse.ErrorCode != string.Empty)
{
urlBuilder.AppendFormat("&error={0}", this.recaptchaResponse.ErrorCode);
}
return urlBuilder.ToString();
}
如果你签出http://recaptcha.net/apidocs/captcha/client.html它说:
“为了避免浏览器
警告,如果您在
SSL 站点,您应该替换http://api.recaptcha.net with
https://api-secure.recaptcha.net."
很明显,recaptcha 支持 HTTPS 提交。 ASP.NET 控件是否有任何可配置出站 URL 的属性?最坏的情况下你可能需要使用反射器检查代码并了解它是如何构建的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)