Confused about modifying password strength requirements in ASP.NET 2.0.

Discussion in 'ASP .Net' started by Paul, Jun 7, 2007.

  1. Paul

    Paul Guest

    Hello All,

    I am working through the SAMS "ASP.NET 2.0 - Unleased" book to teach
    myself ASP.NET. It is a great book, but Chapter 21 "Using ASP.NET
    Membership" is causing me problems - or maybe I am just missing
    something.

    It is telling me that in order to modify user password requirements I
    need to add the following to the web.config file.

    <membership defaultProvider="MyProvider">
    <providers>
    <add
    name="MyProvider"
    type="System.Web.Security.SqlMembershipProvider"
    minRequiredNonalphanumericCharacters="0"
    connectionStringName="LocalSqlServer" />
    </providers>
    </membership>

    The trouble with this is that "MyProvider" (whatever that is) is now
    the default provider so it seems to override the provider that I
    already have (the provider that was created for me the first time I
    used the asp:CreateUserWizard control for the first time).

    How do I modify the web.config file to change the value of
    minRequiredNonalphanumericCharacters without "adding" a provider. What
    is the name of the provider that I already have? I am confused.

    Help is always appreciated.

    Paul
     
    Paul, Jun 7, 2007
    #1
    1. Advertising

  2. re:
    !> What is the name of the provider that I already have?

    The default membership provider is a SqlMembershipProvider
    instance named "AspNetSqlMembershipProvider".

    http://msdn2.microsoft.com/en-us/library/014bec1k(VS.80).aspx

    It contains methods and properties specific to using
    SQL Express 2005 as a data store for membership information.

    It inherits from the MembershipProvider class.
    The MembershipProvider class itself inherits from the ProviderBase class.

    re:
    > How do I modify the web.config file to change the value of
    > minRequiredNonalphanumericCharacters without "adding" a provider.


    Add the required lines, after clearing the existing default provider.

    <membership defaultProvider="MyProvider">
    <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider"
    type="System.Web.Security.SqlMembershipProvider"
    minRequiredNonalphanumericCharacters="0"
    connectionStringName="LocalSqlServer" />
    </providers>
    </membership>

    Make sure you don't leave out any important settings...




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Paul" <> wrote in message
    news:...
    > Hello All,
    >
    > I am working through the SAMS "ASP.NET 2.0 - Unleased" book to teach
    > myself ASP.NET. It is a great book, but Chapter 21 "Using ASP.NET
    > Membership" is causing me problems - or maybe I am just missing
    > something.
    >
    > It is telling me that in order to modify user password requirements I
    > need to add the following to the web.config file.
    >
    > <membership defaultProvider="MyProvider">
    > <providers>
    > <add
    > name="MyProvider"
    > type="System.Web.Security.SqlMembershipProvider"
    > minRequiredNonalphanumericCharacters="0"
    > connectionStringName="LocalSqlServer" />
    > </providers>
    > </membership>
    >
    > The trouble with this is that "MyProvider" (whatever that is) is now
    > the default provider so it seems to override the provider that I
    > already have (the provider that was created for me the first time I
    > used the asp:CreateUserWizard control for the first time).
    >
    > How do I modify the web.config file to change the value of
    > minRequiredNonalphanumericCharacters without "adding" a provider. What
    > is the name of the provider that I already have? I am confused.
    >
    > Help is always appreciated.
    >
    > Paul
    >
     
    Juan T. Llibre, Jun 7, 2007
    #2
    1. Advertising

  3. Aargh! Typo warning !

    That should have been :

    <membership defaultProvider="AspNetSqlMembershipProvider">
    <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider"
    type="System.Web.Security.SqlMembershipProvider"
    minRequiredNonalphanumericCharacters="0"
    connectionStringName="LocalSqlServer" />
    </providers>
    </membership>

    Sorry...

    The rest stands as posted.




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Juan T. Llibre" <> wrote in message
    news:...
    > re:
    > !> What is the name of the provider that I already have?
    >
    > The default membership provider is a SqlMembershipProvider
    > instance named "AspNetSqlMembershipProvider".
    >
    > http://msdn2.microsoft.com/en-us/library/014bec1k(VS.80).aspx
    >
    > It contains methods and properties specific to using
    > SQL Express 2005 as a data store for membership information.
    >
    > It inherits from the MembershipProvider class.
    > The MembershipProvider class itself inherits from the ProviderBase class.
    >
    > re:
    >> How do I modify the web.config file to change the value of
    >> minRequiredNonalphanumericCharacters without "adding" a provider.

    >
    > Add the required lines, after clearing the existing default provider.
    >
    > <membership defaultProvider="MyProvider">
    > <providers>
    > <clear />
    > <add name="AspNetSqlMembershipProvider"
    > type="System.Web.Security.SqlMembershipProvider"
    > minRequiredNonalphanumericCharacters="0"
    > connectionStringName="LocalSqlServer" />
    > </providers>
    > </membership>
    >
    > Make sure you don't leave out any important settings...
    >
    >
    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "Paul" <> wrote in message
    > news:...
    >> Hello All,
    >>
    >> I am working through the SAMS "ASP.NET 2.0 - Unleased" book to teach
    >> myself ASP.NET. It is a great book, but Chapter 21 "Using ASP.NET
    >> Membership" is causing me problems - or maybe I am just missing
    >> something.
    >>
    >> It is telling me that in order to modify user password requirements I
    >> need to add the following to the web.config file.
    >>
    >> <membership defaultProvider="MyProvider">
    >> <providers>
    >> <add
    >> name="MyProvider"
    >> type="System.Web.Security.SqlMembershipProvider"
    >> minRequiredNonalphanumericCharacters="0"
    >> connectionStringName="LocalSqlServer" />
    >> </providers>
    >> </membership>
    >>
    >> The trouble with this is that "MyProvider" (whatever that is) is now
    >> the default provider so it seems to override the provider that I
    >> already have (the provider that was created for me the first time I
    >> used the asp:CreateUserWizard control for the first time).
    >>
    >> How do I modify the web.config file to change the value of
    >> minRequiredNonalphanumericCharacters without "adding" a provider. What
    >> is the name of the provider that I already have? I am confused.
    >>
    >> Help is always appreciated.
    >>
    >> Paul
    >>

    >
    >
     
    Juan T. Llibre, Jun 7, 2007
    #3
  4. Paul

    Paul Guest

    Thanks Juan,

    That brings me a little bit closer to understanding, but I am still
    confused. I added the code that you gave me to the web.config file.

    I am still getting a result that I don't understand. As an experiment
    I have the following Page_Load event in one of my pages.

    protected void Page_Load(object sender, EventArgs e)
    {
    MembershipUserCollection mine = Membership.GetAllUsers();
    foreach (MembershipUser myUser in mine)
    {
    Response.Write(myUser.UserName + "<br />");
    }
    }

    After I added the code that you suggested into the web.config file
    this event produced no output. So as an experiment I created another
    user and loaded the page again. This time I got output - the user that
    I had just added. Then I had a look at the contents of the
    aspnet_Users table in the ASPNETDB.MDF database and found that the
    user I had just added was there with all the other users that I had in
    there before. If all the users are stored in the same place, why does
    the Membership.GetAllUser() method return a collection with only the
    user that I added after I edited the web.config file. I had a look at
    the data in some of the other tables in ASPNETDB.MDF database to see
    if there was a field that gave the GetAllUsers() method the info it
    needed to differentiate between users that I had added before editing
    web.config and those I added after but I could not find anything. I
    must be missing knowledge of some fundamental Membership concept that
    is causing my confusion.

    Paul
     
    Paul, Jun 7, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Dyer
    Replies:
    1
    Views:
    960
    Darryl Pierce
    Apr 11, 2005
  2. AAaron123
    Replies:
    2
    Views:
    2,294
    AAaron123
    Jan 16, 2009
  3. AAaron123
    Replies:
    1
    Views:
    1,372
    Oriane
    Jan 16, 2009
  4. Paul Rubin
    Replies:
    3
    Views:
    312
  5. pramodx

    Password Strength Regular Expression

    pramodx, Dec 12, 2008, in forum: Javascript
    Replies:
    4
    Views:
    210
    pramodx
    Dec 15, 2008
Loading...

Share This Page