Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
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:
C#
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
v4
Comments
kk2014 11-Dec-12 1:06am    
then, what is the question? please elaborate....
24983 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)
24983 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;

1 solution

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.
 
Share this answer
 
Comments
24983 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
24983 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900