How reset password if not know old one

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cirene

    How reset password if not know old one

    Using ASP.NET built in membership.

    I'm creating an "admin interface" to my site.

    Thru code, how can I reset someones password without knowing the old/current
    one?


  • Joe Fawcett

    #2
    Re: How reset password if not know old one



    "Cirene" <cirene@nowhere .comwrote in message
    news:Ocv#QjrvIH A.420@TK2MSFTNG P02.phx.gbl...
    Using ASP.NET built in membership.
    >
    I'm creating an "admin interface" to my site.
    >
    Thru code, how can I reset someones password without knowing the
    old/current one?
    >
    You don't need to know the old password if you use the Reset password
    method, that takes the username and the security question answer.
    Otherwise provide your own MembershipProvi der implementation. Just inherit
    from the standard one and add your own method, ChangePassword, that does
    what you need.

    --

    Joe Fawcett (MVP - XML)


    Comment

    • Stan

      #3
      Re: How reset password if not know old one

      On 25 May, 23:43, "Cirene" <cir...@nowhere .comwrote:
      Using ASP.NET built in membership.
      >
      I'm creating an "admin interface" to my site.
      >
      Thru code, how can I reset someones password without knowing the old/current
      one?
      You can do it with the default membership provider.

      There are a number of settings in web.config that will affect the
      password regime (see example below). If EnablePasswordR eset is false
      then the system will demand the old password or the security question
      answer. Otherwise the ResetPassword() method can have no parameters
      although it will supply an automatically generated new password that
      you cannot choose.

      If you wan't to set the password to something specific then it
      requires two steps:

      string AutoPassword= AMembershipUser .ResetPassword( );
      AmembershipUser .ChangePassword (AutoPassword, "MyPreferredPas sword")

      HTH

      Appendix:

      Extract from web.config where the ASP.NET tab in IIS manager dialog
      has been used to override default settings:

      <membership>
      <providers>
      <remove name="AspNetSql MembershipProvi der" />
      <add connectionStrin gName="LocalSql Server"
      enablePasswordR etrieval="false "
      enablePasswordR eset="true" requiresQuestio nAndAnswer="tru e"
      applicationName ="/" requiresUniqueE mail="false"
      passwordFormat= "Hashed"
      maxInvalidPassw ordAttempts="5" minRequiredPass wordLength="5"
      minRequiredNona lphanumericChar acters="1"
      passwordAttempt Window="10"
      passwordStrengt hRegularExpress ion=""
      name="AspNetSql MembershipProvi der"
      type="System.We b.Security.SqlM embershipProvid er, System.Web,
      Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
      </providers>
      </membership>

      Comment

      • Cirene

        #4
        Re: How reset password if not know old one

        Thanks so much!

        "Stan" <googlestan@phi lhall.netwrote in message
        news:faf1301c-ce43-42ac-8ecb-0f178d551061@p2 5g2000hsf.googl egroups.com...
        On 25 May, 23:43, "Cirene" <cir...@nowhere .comwrote:
        >Using ASP.NET built in membership.
        >>
        >I'm creating an "admin interface" to my site.
        >>
        >Thru code, how can I reset someones password without knowing the
        >old/current
        >one?
        >
        You can do it with the default membership provider.
        >
        There are a number of settings in web.config that will affect the
        password regime (see example below). If EnablePasswordR eset is false
        then the system will demand the old password or the security question
        answer. Otherwise the ResetPassword() method can have no parameters
        although it will supply an automatically generated new password that
        you cannot choose.
        >
        If you wan't to set the password to something specific then it
        requires two steps:
        >
        string AutoPassword= AMembershipUser .ResetPassword( );
        AmembershipUser .ChangePassword (AutoPassword, "MyPreferredPas sword")
        >
        HTH
        >
        Appendix:
        >
        Extract from web.config where the ASP.NET tab in IIS manager dialog
        has been used to override default settings:
        >
        <membership>
        <providers>
        <remove name="AspNetSql MembershipProvi der" />
        <add connectionStrin gName="LocalSql Server"
        enablePasswordR etrieval="false "
        enablePasswordR eset="true" requiresQuestio nAndAnswer="tru e"
        applicationName ="/" requiresUniqueE mail="false"
        passwordFormat= "Hashed"
        maxInvalidPassw ordAttempts="5" minRequiredPass wordLength="5"
        minRequiredNona lphanumericChar acters="1"
        passwordAttempt Window="10"
        passwordStrengt hRegularExpress ion=""
        name="AspNetSql MembershipProvi der"
        type="System.We b.Security.SqlM embershipProvid er, System.Web,
        Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a" />
        </providers>
        </membership>

        Comment

        Working...