views:

54

answers:

1

What is the best practice?
Any samples? I did a search and could not find anything.

I am thinking an Xml file with prohibited words which I could check against during registration and also be used elsewhere on the site to check for prohibited words.

The easy and quick way I thought was in the AccountModel.cs file and adding an attribute or use Regex.

Also, I want to prohibit the use of space in the username.

+2  A: 

We have 2 lists in our database 1) censored words and 2) censored names. When validating usernames we first check the censored words, this list could also be used in other areas like forums etc, then a the censored names is an additional list specific to usernames, for instance "admin", "support", "your company name" etc.

I would add these to your existing database rather than an XML file. You can then just build in an inteface to add more words using your eitsing framework.

You can use javascript to prohibit using spaces, we use the jQuery alphanumeric plugin to dissallow spaces and other prohibited characters. You should also validate this server-side.

Mark Redman