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)
'Declaration
Public NotInheritable Class ReCaptcha
'Usage
You do not need to declare an instance of a static class in order to access its members.
public static class ReCaptcha
public ref class ReCaptcha abstract sealed
public final class ReCaptcha
The ReCaptcha type exposes the following members.
Name | Description | |
---|---|---|
PrivateKey | Gets or sets a private key for the reCAPTCHA service. | |
PublicKey | Gets or sets the public key for the reCAPTCHA service. |
Top
Name | Description | |
---|---|---|
GetHtml | Render a reCAPTCHA control. | |
GetHtmlWithOptions | Render a reCAPTCHA control and enable the caller to pass additional rendering options. | |
Validate | Returns 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 (https://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):
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.
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.