My application is using the Membership API methods.
I have a login page on which the user will be validated using Membership.ValidateUser().
After login he can proceed to use the application.
There is a "Change password" section where I have provided three textboxes -
1.Old pwd
2.New pwd
3. confirm new pwd.
When the user enters the details and clicks on change password button,
I am trying to use the MembershipProvider.ChangePassword() method.
This method requires a MembershipUSer instance so I wrote the following code :
MembershipUser u =
Membership.GetUser(User.Identity.UserName);
if (u !=
null)
{
MembershipProvider
mp;
mp.ChangePassword(u.UserName,TxtPwd.Text,TxtNewPwd.Text);
}
The Problem is that when I am using User.Identity.UserName , I am not getting the username of the currently logged in user. I am getting a blank value - "".
What is wrong ?
Amit ChoudharyPosted Oct 24, 2009, 1:38 AM
=================================
Dont forget to mark answer
Kirtan PatelPosted Oct 24, 2009, 1:33 AM
Why don't you Directly Use Change Password Control From Tool Box ??
if facing difficulty in using change password control then read below Article
http://www.asp.net/learn/security/tutorial-13-cs.aspx
:)
if my answer helps you please check "Do you like this answer" :)