I want to be able to prevent users from registering using specific usernames such as "Admin", "Administrator" etc. Does the MVC MembershipService have a way of doing this or will I have to implement my own method to check each time a user registers?

2 Answers
2

Robert's answer is pretty expedient if inelegant. A more elegant way would be to put some logic into the AccountController's Register method to check names against a "blacklist" then add appropriate ModelErrors if the name is blacklisted. You could also fold in other logical checks--such as verifying the user name isn't a collection of symbols, isn't profane, etc.

One could make an argument that this should really be implemented in the MembershipProvider rather than a controller and one would be pretty spot on but that is beyond the scope of this answer.

You are right, all I was really asking was whether or not the MembershipProvder already had something to do it and I suppose it doesn't. However, your answer did give an easily implementable solution. Thanks
–
The_LoraxJul 8 '09 at 5:34