Export (0) Print
Expand All

ReCaptcha Class

Generates a CAPTCHA test that is based on the reCAPTCHA service.

System.Object
  Microsoft.Web.Helpers.ReCaptcha

Namespace:  Microsoft.Web.Helpers
Assembly:  Microsoft.Web.Helpers (in Microsoft.Web.Helpers.dll)

public static class ReCaptcha

The ReCaptcha type exposes the following members.

  NameDescription
Public propertyStatic memberPrivateKeyGets or sets a private key for the reCAPTCHA service.
Public propertyStatic memberPublicKeyGets or sets the public key for the reCAPTCHA service.
Top

  NameDescription
Public methodStatic memberGetHtmlRender a reCAPTCHA control.
Public methodStatic memberGetHtmlWithOptionsRender a reCAPTCHA control and enable the caller to pass additional rendering options.
Public methodStatic memberValidateReturns a value that indicates whether the user is validated.
Top

This class represents a helper, which is a component that simplifies Web programming in ASP.NET Web Pages. You can use the ReCaptcha class to help protect against malicious computer programs that make automated attacks on Web sites. The class generates a CAPTCHA, which is a test that checks user input based on the reCAPTCHA service. To use the service, you must register at the reCAPTCHA Web site (http://www.recaptcha.net) and obtain public and private keys.

A CAPTCHA test validates that user input is submitted by a human rather than a computer program. This helps prevent typical automated attacks such as adding spam comments to blogs or forums, or creating false user accounts on Web sites. A typical CAPTCHA test generates random text in the form of a distorted graphic image, which humans can read but computer programs cannot. If users correctly submit the randomly generated text shown in the distorted image, the CAPTCHA validates them.

To use the ReCaptcha class to help protect your Web site against automated attacks, use the following steps at the points where the code validates user input (such as when it creates a new account or logs in a user):

  1. Render the reCAPTCHA control. This is the form that displays a graphic image of words and prompts users to submit the correct text values. Call the GetHtml(String, String, String, Int32) method or the GetHtmlWithOptions(String, Object) method to render the reCAPTCHA control.

  2. Validate the user input. Call the Validate(String) method to verify that the input passes the CAPTCHA test. If the method returns true, the code can allow the user to continue. If the method returns false, the code can take another action such as notifying the user that the input was incorrect and prompting the user to try again.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft