Scott on Writing

Musings on technical writing...

Tuesday, June 06, 2006 #

Login Control + CAPTCHA

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...]

posted @ 3:31 PM | Feedback (12)

My Links

Ads Via DevMavens

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<June 2006>
SMTWTFS
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

Comment Stats

DayTotal% of Total
Sunday 1926.8%
Monday 39714.1%
Tuesday 47316.8%
Wednesday 52218.5%
Thursday 54519.4%
Friday 51118.2%
Saturday 1756.2%
Total 2815100.0%

Hour1Total% of Total
12:00 AM 692.5%
1:00 AM 712.5%
2:00 AM 642.3%
3:00 AM 762.7%
4:00 AM 592.1%
5:00 AM 1124.0%
6:00 AM 1113.9%
7:00 AM 1625.8%
8:00 AM 1776.3%
9:00 AM 1515.4%
10:00 AM 1746.2%
11:00 AM 1836.5%
12:00 PM 1926.8%
1:00 PM 1786.3%
2:00 PM 1605.7%
3:00 PM 1344.8%
4:00 PM 1134.0%
5:00 PM 993.5%
6:00 PM 923.3%
7:00 PM 993.5%
8:00 PM 873.1%
9:00 PM 812.9%
10:00 PM 832.9%
11:00 PM 883.1%
Total 2815100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.14144
Monday 5.28359
Tuesday 4.31448
Wednesday 7.51646
Thursday 6.81633
Friday 5.35417
Saturday 5.09168
Total 5.742815

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.24110
9:00 AM 6.09280
10:00 AM 6.33253
11:00 AM 4.28184
12:00 PM 6.86343
1:00 PM 2.87112
2:00 PM 5.29222
3:00 PM 8.57300
4:00 PM 3.7694
5:00 PM 5.79162
6:00 PM 4.56114
7:00 PM 9.58182
8:00 PM 8.78158
9:00 PM 5.18114
10:00 PM 5.9383
11:00 PM 4.5732
Total 5.742815

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles