Click here to Skip to main content
13,044,115 members (103,974 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I going to reset password in membership user then I have entered the same (old) password into the new password field then If password is same then display message .
Ex Code:
object objUserID = (System.Guid)Membership.GetUser(strEmployerUserName).ProviderUserKey;
MembershipUser objUsr = Membership.GetUser(objUserID); 
string strPassword = objUsr.ResetPassword(objCurrentPortalUser.UserTypeLK);
boolResult = objUsr.ChangePassword(strPassword, strNewPassword);

I used membership control...Please help me...
Posted 10-Dec-12 18:31pm
kkakadiya 11-Dec-12 1:06am
then, what is the question? please elaborate....
santhosh19783 11-Dec-12 1:24am
When i put same password in new password field then If Password is same I want to display Message This is Membership control.
pradiprenushe 11-Dec-12 1:26am
Use compare validator to check two textbox are different (olpwd & newpwd)
santhosh19783 11-Dec-12 1:32am
Ok...but When i get old passwordfrom Membership Table using Reset Password .How can we use compare validator?
pradiprenushe 11-Dec-12 2:04am
string oldpwd= objUsr.GetPassword();
Check this with strNewPassword;
santhosh19783 11-Dec-12 5:26am
string oldpwd= objUsr.GetPassword();
Then throw this error:
This Membership Provider has not been configured to support password retrieval.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

First try to validate the new password, if it is successful which means it is same as old password, throw exception otherwise you are good to go.
use Membership.ValidateUser(UserName, newPassword);

When you use passwordFormat as Hashed, membership will not allow to retrieve password text because it is one way hash (most secured), to validate it compares hash of passwords to be equal.
santhosh19783 12-Dec-12 0:56am
Thanks...I passed username and password in Membership.ValidateUser()Then it always return false.. What can i do further?
Rohit Shrivastava 12-Dec-12 1:21am
call this before reseting and any code
santhosh19783 12-Dec-12 1:50am
Thanks rohit I got it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100