Login Control + CAPTCHA

Posted by: Scott on Writing, on 06 Jun 2006 | View original | Bookmarked: 0 time(s)

My latest installment (Part 5) of the Examining ASP.NET 2.0's Membership, Rols, and Profile article series shows how to extend the Login control to add additional Web controls to the interface and how to customize the authentication logic accordingly. In particular, the article includes a demo (among others) that shows how to add a CAPTCHA to the Login control. For that demo I'm using Jeff Atwood's free (and open-source) ASP.NET CAPTCHA server control.

In short, to accomplish this perform the following tasks:

  • Convert the Login control into a template. This can be done from the Designer by clicking on the Convert to Template option in the control's smart tag
  • Augment the Login control's template markup to include Jeff's CAPTCHA control (my example also requires that the user enter their email address on file)
  • Create an event handler for the Login control's Authenticate event. In there, verify the user's username and password via a call to Membership.ValidateUser(username, password). Assuming that that check passes, programmatically access the Email and CAPTCHA controls using LoginControlID.FindControl(ID) and verify the validity of those inputs. If the user has supplied valid inputs all around, set e.Authenticate to True; otherwise, if any check fails, set e.Authenticate to False.

That's all there is to it!

[Read the article...]

Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 3692 | Hits: 97

Similar Posts

  • Designer v Xaml v Code more
  • Choose your preferred data layout with RadListView for ASP.NET AJAX more
  • ASP.NET MVC2 Preview 2: Areas and Routes more
  • Ajax Control Toolkit: new controls, bug fixes more
  • Behaviors vs Subclassing in Silverlight more
  • Integrating OpenID in an ASP.NET MVC Application using DotNetOpenAuth more
  • Telerik Releases New Controls for Silverlight 3 and WPF more
  • Q3 2009 Beta released for Telerik RadControls for Silverlight/WPF more
  • Custom Panels in Silverlight/WPF Part 4: Virtualization more
  • How to Create an ASP.NET Modal Popup Login more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD