Home > ASP.Net > Change Password using Membership

Change Password using Membership


Hi all

try this example to Change Password using Membership for Logged in User

1) Create Web page call it “changePassword.aspx” and from Toolbox add two TextBoxes (one for OldPassword and the other for New Password) control and Button Control to Change Password of user and Lable to show Result

so in Button Click event add this Code :-


public void ChangePassword_OnClick(object sender, EventArgs args)
{
try
{
// Update the password.

if (Membership.Provider.ChangePassword(User.Identity.Name, OldPasswordTextbox.Text, PasswordTextbox.Text))
{
Msg.Text = “Password changed.”;
return;
}
}
catch
{
}

Msg.Text = “Password change failed. Please re-enter your values and try again.”;
}

for more details you can visit this link from here

Good Luck

Advertisements
Categories: ASP.Net
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: