SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was looking if it's possible to re-use the Sharepoint validation control used to check the URL name for special characters. I like to use this error validation in my custom application page to create new sites.

I'm looking for the ValidationExpression in fact...

Thanks in advance!

PS. Karine Bosh has written some nice post about validation controls:

share|improve this question

If you look at newsbweb.aspx you'll see that the validation is done in the form submit event rather than by a control

var ix = IndexOfIllegalCharInUrlLeafName(stname);
if (ix == -1)
    ix = stname.indexOf("+");
if(ix != -1)
    var ch = stname.charAt(ix);
    alert(StBuildParam(L_ContainIllegalChar_Text, L_webfield_TEXT, ch));
    return false;

The IndexOfIllegalCharInUrlLeafName function is contained in commonvalidation.js which also contains other url utility functions such as UrlContainsIllegalStrings

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.