views:

95

answers:

2

I am using dotnetnuke 4.9.5 (ASP.Net 2.0) and its default membership provider i.e. AspnetSqlMembershipProvider. Currently a username of length 1 is legal. Is there anyway I could restrict the minimum length for username?

A: 

The SqlMembershipProvider doesn't have configuration for anything about username length. Why not just validate the text input manually?

Gabriel McAdams
This is the only thing that I myself could think of. I was just wondering if I missed something.
Kashif
+1  A: 

Gabriel's method is probably way easier, but you could also implement a custom membership provider and inherit from the SqlMembershipProvider and add that validation in the CreateUser method. You might want to refer to this article (caution: it is VB not C#).

Don't be intimidated, though -- since you'll be inheriting most of the base class's logic, your only work will really be to add in your validation on that one method.

Josh