Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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:
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
Smart83548
Edited 10-Dec-12 19:46pm
Tadit Dash85.5K
v4
Comments
kkakadiya at 11-Dec-12 1:06am
   
then, what is the question? please elaborate....
santhosh19783 at 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 at 11-Dec-12 1:26am
   
Use compare validator to check two textbox are different (olpwd & newpwd)
santhosh19783 at 11-Dec-12 1:32am
   
Ok...but When i get old passwordfrom Membership Table using Reset Password .How can we use compare validator?
pradiprenushe at 11-Dec-12 2:04am
   
string oldpwd= objUsr.GetPassword(); Check this with strNewPassword;
santhosh19783 at 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
good
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.
  Permalink  
Comments
santhosh19783 at 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 at 12-Dec-12 1:21am
   
call this before reseting and any code
santhosh19783 at 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
0 Sergey Alexandrovich Kryukov 686
1 OriginalGriff 498
2 Tadit Dash 420
3 sanket saxena 337
4 Zoltán Zörgő 230
0 Sergey Alexandrovich Kryukov 11,800
1 OriginalGriff 7,225
2 Peter Leow 5,009
3 Abhinav S 3,893
4 Maciej Los 3,575


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