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>