question regarding checking if user exists, customValidator

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hi

asp.net 3.5

On my website I want to implement a customValidor on the registration page,
so that a custom error appear when someone trys to register a user who
already exists...

So I'm wondering about how to do that script the check if that user already
exists....

My approach:
MembershipUser user = Membership.GetUser( <name entered in textbox> );
if (user == null)
return false;
else
return true;

Don't think that apprach is optimal, so I hope maybe there are some better
ways of doing this..

any suggestions?
 
The approach may not be "optimal", but user sign ups are not the primary
reason sites exist, so an "unoptimal" sign up is not a problem. I also
prefer this method to attempt to create and bomb, which is your other
option.The bomb methodology is even less optimal.

On a small site, you can load all users into a hashtable, or similar, and
have a very quick lookup. On a small site, this is "optimal", but it is
overbearing on a large site.

You can have the check set up in AJAX and give instant feedback. The
methodology may still not be "optimal", but it is nicer for the user than
hit submit and find out things have gone wrong.

--
Gregory A. Beamer
MVP; MCP: +I, Se, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

*************************************************
| Think outside the box! |
*************************************************
 
Back
Top