本文介绍了.NET的Recaptcha HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经使用ASP.NET验证码控制启动,并工作正常。但我们有一个要求是,所有出站流量都通过HTTPS。

我知道的reCAPTCHA支持HTTPS,但目前还不清楚如何配置(或者即使它是可配置)使用ASP.NET插件选项时。

有没有人有这样的经验吗?

我会扩大我到目前为止找到了一点......

的ReCaptcha包中包含3公开课

RecaptchaControl,
RecaptchaValidator


RecaptchaResponse

RecaptchaControl 是一个Asp.NET控制的ReCaptcha上有具体的方法似乎是关于主题/外观和感觉。

该校验器的实例有一个REMOTEIP场(我presume将重新present验证服务器),但我无法在绑定方式来控制。

RecaptchaResponse 似乎或多或少重新present与可能的反应枚举(有效/无效/无法连接)。

看起来像的ReCaptcha控制智能选择 HTTPS 如果请求是HTTPS。
我presuming它为验证相同,但它不是从源头code清晰

 私人常量字符串VerifyUrl =htt​​p://www.google.com/recaptcha/api/verify;
私人常量字符串RECAPTCHA_SECURE_HOST =htt​​ps://api-secure.recaptcha.net;
私人常量字符串RECAPTCHA_HOST =htt​​p://api.recaptcha.net;
-------------------------------- SNIP ----------------- -------------------
///<总结>
        ///这个函数生成的挑战URL。
        ///< /总结>
        私人字符串GenerateChallengeUrl(布尔的NoScript)
        {
            StringBuilder的urlBuilder =新的StringBuilder();
            urlBuilder.Append(?Context.Request.IsSecureConnection || this.overrideSecureMode RECAPTCHA_SECURE_HOST:RECAPTCHA_HOST);
            urlBuilder.Append(?NoScript的/无脚本?:/挑战是什么?);
            urlBuilder.AppendFormat(K = {0},this.PublicKey);
            如果(this.recaptchaResponse = NULL&放大器;!&安培;!this.recaptchaResponse.Error code =的String.Empty)
            {
                urlBuilder.AppendFormat(与&误差= {0},this.recaptchaResponse.Error code);
            }            返回urlBuilder.ToString();
        }


解决方案

如果您检查http://recaptcha.net/apidocs/captcha/client.html它说:

So clearly recaptcha supports HTTPS submissions. Does the ASP.NET control have any properties you can configure the outbound URL? At worst you might need to use Reflector to examine the code and see how it's built.

这篇关于.NET的Recaptcha HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 20:03