Setting Allowable Characters for Passwords

Last post 03-31-2008 11:56 PM by XiaoYong Dai – MSFT. 6 replies.

Sort Posts:

  • Setting Allowable Characters for Passwords

    03-25-2008, 1:36 PM
    • Loading...
    • Armysniper
    • Joined on 06-21-2003, 10:37 AM
    • Boston, MA
    • Posts 236

    I know there is a regular expression field in the web.config section for membership that allows me to specify a regular expression for password strength. The problem is I have no idea how to set it up to simply allow any character to be used in the password. I don't care about length or min right now because I want to migrate users over and then reset the passwords later. Right now I just need to migrate my users over and the membership provider that I am using for my project, restricts # from being used. I got this as a regex:

     

    ^.*(?=.{7,})(?=.{1,5}[?,./>'~!@#$%^&*()_+-={}|\:;'<>?,./]).*$

     

    And tried to modify it by setting the 7 to 1. But when I put this in web.config it does not accept it and breaks on build. HELP!

  • Re: Setting Allowable Characters for Passwords

    03-25-2008, 1:50 PM
    • Loading...
    • dprior
    • Joined on 11-23-2007, 5:00 PM
    • Posts 151

    ^.*$ 

    Please remember to mark any helpful responses as answers.
  • Re: Setting Allowable Characters for Passwords

    03-25-2008, 4:21 PM
    • Loading...
    • Armysniper
    • Joined on 06-21-2003, 10:37 AM
    • Boston, MA
    • Posts 236

    dprior:

    ^.*$ 

     Ummm....where do I put this in the RegEx??

  • Re: Setting Allowable Characters for Passwords

    03-27-2008, 4:25 AM
    Answer
    Hi
    Base on my understanding, you want to reduce the password strength when create membership user, here is an example might help 
            <providers>
              <clear/>
              <add name="AspNetSqlMembershipProvider"
                     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                     connectionStringName="LocalSqlServer"
                     enablePasswordRetrieval="false"
                     enablePasswordReset="true"
                     requiresQuestionAndAnswer="true"
                     requiresUniqueEmail="false"
                     minRequiredPasswordLength="1"
                     minRequiredNonalphanumericCharacters="0"
                     passwordStrengthRegularExpression="^[^#]*$" />
            </providers>     

     

     

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
  • Re: Setting Allowable Characters for Passwords

    03-27-2008, 10:53 AM
    Answer
    • Loading...
    • dprior
    • Joined on 11-23-2007, 5:00 PM
    • Posts 151

    Armysniper:

    dprior:

    ^.*$ 

     Ummm....where do I put this in the RegEx??

     

     

    That *IS* the RegEx.  The entire thing.

     

    ^ = matches start of string

    . = matches any character

    * = matches the preceding expression (in this case '.') zero or more times.

    $ = matches the end of the string

     

    Actually, you should probably change it to "^.+$" as the first expression would match an empty string, I believe.  The plus sign is the same as the * sign, except that it matches 1 or more instead of zero or more.
     

    Please remember to mark any helpful responses as answers.
  • Re: Setting Allowable Characters for Passwords

    03-31-2008, 3:26 PM
    • Loading...
    • Armysniper
    • Joined on 06-21-2003, 10:37 AM
    • Boston, MA
    • Posts 236

    XiaoYong Dai – MSFT:
    Hi
    Base on my understanding, you want to reduce the password strength when create membership user, here is an example might help 
            <providers>
              <clear/>
              <add name="AspNetSqlMembershipProvider"
                     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                     connectionStringName="LocalSqlServer"
                     enablePasswordRetrieval="false"
                     enablePasswordReset="true"
                     requiresQuestionAndAnswer="true"
                     requiresUniqueEmail="false"
                     minRequiredPasswordLength="1"
                     minRequiredNonalphanumericCharacters="0"
                     passwordStrengthRegularExpression="^[^#]*$" />
            </providers>     

     

     

     

    What if I wanted it so that it would allow ALL characters EXCEPT the # character. What would my RegEx look like?

  • Re: Setting Allowable Characters for Passwords

    03-31-2008, 11:56 PM

    Hi

    The RegEx is   ^[^#]*$ 

    Here you can find more information

    http://msdn2.microsoft.com/en-us/library/ms972966.aspx

    Best Regards
    XiaoYong Dai
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Page 1 of 1 (7 items)