tanveery / recaptcha-net

reCAPTCHA for .NET library lets you easily use Google's reCAPTCHA in an ASP.NET Web Forms / MVC / ASP.NET Core application.
Apache License 2.0
163 stars 69 forks source link

Support for JSON or other response type #66

Open jehhynes opened 2 years ago

jehhynes commented 2 years ago

If the content-type of a form is JSON, then I am getting the following error:

System.InvalidOperationException: Incorrect Content-Type: application/json; charset=UTF-8 at Microsoft.AspNetCore.Http.Features.FormFeature.ReadForm() at Microsoft.AspNetCore.Http.DefaultHttpRequest.get_Form() at Recaptcha.Web.RecaptchaVerificationHelper..ctor(HttpContext httpContext, String secretKey) at Recaptcha.Web.Mvc.RecaptchaMvcExtensions.GetRecaptchaVerificationHelper(Controller controller) at

In this case, the recaptcha response is included as part of the JSON object, and so it can be passed into the RecaptchaVerificationHelper constructor.