Tyg*_*ash 6 asp.net https recaptcha
我们已经开始使用ASP.NET recaptcha控件,它工作正常.但我们的要求之一是所有出站流量超过Https.
我知道recaptcha支持https,但是在使用ASP.NET插件选项时,不清楚如何配置(或者即使它是可配置的).
有没有人有这方面的经验?
我将对我迄今发现的内容进行一点扩展....
Recaptcha包含3个公共类
RecaptchaControl,
RecaptchaValidator
和
RecaptchaResponse
RecaptchaControl 是一个Asp.NET控件,那里的recaptcha特定方法似乎与主题/外观有关.
Validator的一个实例有一个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();
}
Run Code Online (Sandbox Code Playgroud)
Dan*_*plo 12
如果您查看http://recaptcha.net/apidocs/captcha/client.html,它会说:
"为了避免让浏览器警告,如果在一个SSL网站上使用验证码,就应该更换 http://api.recaptcha.net与 https://api-secure.recaptcha.net."
所以显然recaptcha支持HTTPS提交.ASP.NET控件是否具有可以配置出站URL的任何属性?在最坏的情况下,您可能需要使用Reflector来检查代码并查看它是如何构建的.
.NET库不需要任何配置即可在HTTPS环境中运行.它将从当前得出HttpContext请求是否来自HTTPS协议.
但是,有一些RecaptchaControl.OverrideSecureMode属性可以使用,以防万一它不能按预期工作.设置为True强制HTTPS模式.
更新:
我似乎误解了这个问题.我担心没有用于reCAPTCHA验证的HTTPS端点(在您的服务器和他们的服务器之间).
| 归档时间: |
|
| 查看次数: |
6816 次 |
| 最近记录: |