Posts

Showing posts from April, 2017

Google reCAPTCHA using HttpClient in ASP.NET

Image
Introduction reCAPTCHA   is a free service that protects your site from spam and abuse. It uses advanced risk analysis techniques to tell humans and bots apart. With the new API, a significant number of your valid human users will pass the  reCAPTCHA  challenge without having to solve a  CAPTCHA . Building The Code Before you start, visit this link  https://www.google.com/recaptcha/intro/index.html  and click on the Get  reCAPTCHA  button and follow the steps. Let's Get started  Step 1 : Create a class or a method in your controller and add the code below.             public async Task<string> GetRecaptcha()         {             var response = HttpContext.Current.Request["g-recaptcha-response"];             const string secretKey = "your secret key";             var apiConsumer = new ApiConsumer();             const string url = "https://www.google.com/recaptcha/";             apiConsume