Thursday, July 9, 2009

CAPTCHA or HIP Control

Scenario:
I worked on sometime back and still few friends of mine keep asking about me.
CAPTCHA is a way to ensure that requester is a human.

Solution:
Small ASP.Net, with 2 pages only.
Login.aspx and Default.aspx

CAPTCHA

Logic is pretty simple : Login page has CAPTCHA control and use server side Validation for it.
On Button click it checks if Page.IsValid = True, if page is valid then it redirects to the Default page.

Code:

  protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
Response.Redirect("default.aspx");
}
}
Download:
VS 2008 Project

0 comments: