Google reCAPTCHA Validator This entire class came out of a chat discussion, and I'm curious on how it looks. (This is like literally 30 minutes of development time.)

The idea is to allow very easy, quick implementations of Google's reCAPTCHA ("I am not a robot") checkbox CAPTCHA algorithm. It only requires minor work from the implementor to make it work properly, and that was the point.

Warning: Minimal implementation effort required.

public class ReCaptchaValidator
{
    private const string _HeadScriptInclude = "&lt;script src='https://www.google.com/recaptcha/api.js'&gt;&lt;/script&gt;";
    private const string _ReCaptchaLocationInclude = "&lt;div class=\"g-recaptcha %EXTRACLASSES%\" data-sitekey=\"%SITEKEY%\"&gt;&lt;/div&gt;";

    private readonly string _ReCaptchaSecret;
    private readonly string _ReCaptchaSiteKey;

    /// &lt;summary&gt;
    /// Returns the script to be included in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; of the page.
    /// &lt;/summary&gt;
    public string HeadScriptInclude { get { return _HeadScriptInclude; } }

    /// &lt;summary&gt;
    /// Use this to get or set any extra classes that should be added to the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; that is created by the &lt;see cref="ReCaptchaLocationInclude"/&gt;.
    /// &lt;/summary&gt;
    public List&lt;string&gt; ExtraClasses { get; set; }

    /// &lt;summary&gt;
    /// Returns the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; that should be inserted in the HTML where the reCAPTCHA should go.
    /// &lt;/summary&gt;
    /// &lt;remarks&gt;
    /// I'm still not sure if this should be a method or not.
    /// &lt;/remarks&gt;
    public string ReCaptchaLocationInclude { get { return _ReCaptchaLocationInclude.Replace("%SITEKEY%", _ReCaptchaSiteKey).Replace("%EXTRACLASSES%", string.Join(" ", ExtraClasses)); } }

    /// &lt;summary&gt;
    /// Creates a new instance of the &lt;see cref="ReCaptchaValidator"/&gt;.
    /// &lt;/summary&gt;
    /// &lt;param name="reCaptchaSecret"&gt;The reCAPTCHA secret.&lt;/param&gt;
    /// &lt;param name="reCaptchaSiteKey"&gt;The reCAPTCHA site key.&lt;/param&gt;
    public ReCaptchaValidator(string reCaptchaSecret, string reCaptchaSiteKey)
    {
        _ReCaptchaSecret = reCaptchaSecret;
        _ReCaptchaSiteKey = reCaptchaSiteKey;
    }

    /// &lt;summary&gt;
    /// Determines if the reCAPTCHA response in a &lt;code&gt;NameValueCollection&lt;/code&gt; passed validation.
    /// &lt;/summary&gt;
    /// &lt;param name="form"&gt;The &lt;code&gt;Request.Form&lt;/code&gt; to validate.&lt;/param&gt;
    /// &lt;returns&gt;A boolean value indicating success.&lt;/returns&gt;
    public bool Validate(NameValueCollection form)
    {
        string reCaptchaSecret = _ReCaptchaSecret;
        string reCaptchaResponse = form["g-recaptcha-response"];
        bool passedReCaptcha = false;

        using (WebClient client = new WebClient())
        {
            byte[] response = client.UploadValues("https://www.google.com/recaptcha/api/siteverify",
                                                    new NameValueCollection() { { "secret", reCaptchaSecret }, { "response", reCaptchaResponse } });

            string reCaptchaResult = System.Text.Encoding.UTF8.GetString(response);

            if (reCaptchaResult.IndexOf("\"success\": true") &gt; 0)
                passedReCaptcha = true;
        }

        return passedReCaptcha;
    }
}


Usage:

string reCaptchaSecret = "";
string reCaptchaSiteKey = "";

ReCaptchaValidator rcv = new ReCaptchaValidator(reCaptchaSecret, reCaptchaSiteKey);
bool passedReCaptcha = rcv.Validate(Request.Form);


It should be pretty self-explanatory. You can use the ReCaptchaValidator.HeadScriptInclude to get the entire &lt;script&gt; tag for the head, and ReCaptchaValidator.ReCaptchaLocationInclude to get the &lt;div&gt; element for placement in the body. These aren't demonstrated here, but are easy to implement.
Some quick shots at the code  


by retrieving the ReCaptchaLocationInclude property an ArgumentNullException is thrown, because you didn't initialize the ExtraClasses property. I would also like to suggest changing this property from autoimplemented to a normal one, so you can validate any set value.  
bool passedReCaptcha = false; is not really a good name here. so I wouldn't use this variable at all. Instead I would replace this  

if (reCaptchaResult.IndexOf("\"success\": true") &gt; 0)
    passedReCaptcha = true;  


with 

    return (reCaptchaResult.IndexOf("\"success\": true") &gt; 0);


and for the IDE's love add a return false; at the end of the method. If you don't want to do this, it is fine too, but you should replace the former if with passedReCaptcha = (reCaptchaResult.IndexOf("\"success\": true") &gt; 0);