Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

How reset password if not know old one

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cirene - 25 May 2008 23:43 GMT
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 - 26 May 2008 08:42 GMT
> 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 MembershipProvider implementation. Just inherit
from the standard one and add your own method, ChangePassword, that does
what you need.

Signature

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

Stan - 27 May 2008 00:10 GMT
> 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 EnablePasswordReset 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, "MyPreferredPassword")

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="AspNetSqlMembershipProvider" />
       <add connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
         enablePasswordReset="true" requiresQuestionAndAnswer="true"
         applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed"
         maxInvalidPasswordAttempts="5" minRequiredPasswordLength="5"
         minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
         passwordStrengthRegularExpression=""
name="AspNetSqlMembershipProvider"
         type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     </providers>
   </membership>
Cirene - 27 May 2008 01:33 GMT
Thanks so much!

>> Using ASP.NET built in membership.
>>
[quoted text clipped - 43 lines]
>      </providers>
>    </membership>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.