henriqb / recaptcha-asp-net Goto Github PK
View Code? Open in Web Editor NEWGoogle ReCaptcha for Asp Net, simplified
License: MIT License
Google ReCaptcha for Asp Net, simplified
License: MIT License
After upgrading the NewtonSoft.Json to version 12 in one of my projects the recaptcha package stopped working. Apparently it enforces the use of NewtonSoft.Json 9?
System.IO.FileLoadException: 'Could not load file or assembly "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Ausnahme von HRESULT: 0x80131040)'
I have an application using this library to do recaptcha verification, which works fine when running on a server where TLS 1.0, 1.1, and 1.2 are all enabled. However when I run the app on a server on which only TLS 1.2 is enabled the verification step fails with a WebException inside this library.
My question: is there any chance that this component has some kind of hard dependency on TLS 1.0/1? If so, I cannot use it in my target environment. All my searches on this error point to a TLS rejection.
Here's the stack trace:
WebException exception-message="The underlying connection was closed: An unexpected error occurred on a receive."
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at hbehr.recaptcha.WebCommunication.GoogleWebPost.CreatePostWebRequest(String postData, WebProxy proxy)
at hbehr.recaptcha.WebCommunication.GoogleWebPost.PostUserAnswer(String response, String secretKey, WebProxy proxy)
at hbehr.recaptcha.ReCaptchaObject.ValidateResponse(IReChaptaWebInterface webInterface, String response, WebProxy proxy)
Hi
Thank you so much for putting this code together. Can you provide a bit more detail on how to deal with the exception? I just need my users to click the radio button. I really don't need them to put in any information. But due to my lack of coding experience, I don't know where to go with that exception. I think you just have it there for folks who want to ask the user some question like: "what is 2 + 5", or what is your email address or something. I guess I can just delete the following:
bool validCaptcha = hbehr.recaptcha.ReCaptcha.ValidateCaptcha(userResponse); if (validCaptcha) { return View(); } else { // Bot Attack, non validated ! return RedirectToAction("YouAreARobot", "Index"); }
Does this work with the new invisible recaptcha?
I encounter a nasty issue with a page in Hebrew.
I use 'auto' mode, and that works fine for English, French and Dutch.
For Hebrew, the package fails with a nasty stack exception.
My first thoughts were this has to do with the right to left rendering, but in fact this is due to the auto language detection that fails because the Google recaptcha code for Hebrew is 'iw' and not 'he' like what is returned by the CultureInfo.CurrentUICulture (= "he").
Extract from the code :
public static string GetLanguage(this ReCaptchaLanguage language) { if (language == ReCaptchaLanguage.Auto) { var newLanguage = GetLanguageByCulture(CultureInfo.CurrentUICulture); return GetLanguage(newLanguage.GetValueOrDefault()); } var attribute = language.GetType().GetMember(language.ToString()).Select(m => m.GetCustomAttribute<LanguageAttribute>()).FirstOrDefault() ?? new LanguageAttribute(string.Empty); return attribute.Value; }
I don't know why google folks invented that strange 'iw' code
and i don't know if there are more languages for which the auto-detection fails because the google code is different from the value returned by the culture.
For now i have it fixed by choosing and mapping the language in my page :
@hbehr.recaptcha.ReCaptcha.GetCaptcha(@hbehr.recaptcha.ReCaptchaLanguage.Hebrew);
This works and correctly gives the hebrew captcha.
Typo in Readme.MD "Instalation
" โ "Installation
".
Dear,
We implemented this easy to use library but we noticed an issue when applied for a certain customer of ours. Most of the time, a captcha appears where you have to check a box saying "I'm not a robot" and in that case, everything works fine... Only, from time to time, a captcha appears where you have to validate an image and as a result, the captcha could not be validated.
There is no such mention of this option so my question is, is there a possibility to support image validation? Or disable this option so it always results in the checkbox? Or is there a possibility within the Google Recaptcha website to do something about it?
Kind regards,
Kevin Cocquyt
Can this be implemented in WebForms? Not MVC or ASP Pages. For example I tried changing the client side script of
@ReCaptcha.GetCaptcha()
to
<% ReCaptcha.GetCaptcha(); %>
but no control is rendered.
I need to apply an id attribute to the button in addition to classes which is supported. Conceivably, other html attributes would be needed/useful.
Hi, great package!
For me to update this package for our projects I need to know what changed. Right now that is not easy, because there is no changelog, no release (or one really old) or no tags.
Would it be possible to define some changelog, or at least work with releases, so I and my team knows what changed between versions. Thanks.
Please provide a way to process the ValidateCaptcha call from behind a proxy.
Hi is possible to pass in a theme option, so it will be possible to render the recaptcha in the dark format
I have many sites that use the reCaptcha and near the limit of 25 so I disabled the option for site verification in the Google settings. It is recommended that I do my own verification when doing this by verifying the hostname returned from the call to Google's siteverify which is done in ReCaptcha.ValidateCaptcha().
Perhaps this can be added as an option parameter passing the current hostname and if it does not match, fail the captcha.
Hi,
I'm wanting to add this to an old project, but because of the dependency chain starting at newtonsoft.json everything wants to upgrade
Is there a practical reason there could not be lower minimum version for newtonsoft.json?
(in my case 6.0.6 or less would be good)
Using @using hbehr.recaptcha
I just get that hbehr could not be found. Is this correct?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.