reCaptcha验证超时 [英] reCaptcha validation time out

查看:78
本文介绍了reCaptcha验证超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在1and1托管网站上验证Google reCaptcha.但是,当我在服务器上执行此功能时,它花费的时间太长,并且我的页面已超时.谁能指出导致问题的原因.

I am trying to validate Google reCaptcha on my 1and1 hosted website. But when I execute this function on Server, It takes too long and my page is timed out. Can anyone point me out what is causing problem.

private string VerifyRecaptcha(string secret, string responseCode)
{
    WebRequest request = WebRequest.Create("https://www.google.com/recaptcha/api/siteverify");
    request.Method = "POST";
    string postData = "secret=" + secret + "&response=" + responseCode;
    byte[] byteArray = Encoding.UTF8.GetBytes(postData);
    request.ContentType = "application/x-www-form-urlencoded";
    request.ContentLength = byteArray.Length;
    Stream dataStream = request.GetRequestStream();
    dataStream.Write(byteArray, 0, byteArray.Length);
    dataStream.Close();
    WebResponse response = request.GetResponse();
     dataStream = response.GetResponseStream();
    StreamReader reader = new StreamReader(dataStream);
    string responseFromServer = reader.ReadToEnd();
    reader.Close();
    dataStream.Close();
    response.Close();
    return responseFromServer; 

}

推荐答案

这可能是由于服务器上的防火墙问题能够与Google域进行通信.如果您有防火墙,则可能不允许通过google呼叫,尤其是按IP地址进行过滤时.Google有一系列您需要打开的IP.

This could be due to firewall issues on the server being able to communicate to the google domain. If you have a firewall, it may not be letting through calls to google, especially if it is filtering by IP address. Google has a range of IP's that you need to open up.

这篇关于reCaptcha验证超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆