Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Changing passwords through a web part

  Asked By: Ricardo Mcdonald         Date: Apr 28, 2010      Category: Sharepoint      Views: 449
 

I wrote a Web Part for Sharepoint Portal 2003 that allows the
user to change his password. It works, as in the password is indeed
changed, but the problem is that instead of reloading the page
afterwards, it instead throws me to a page with a "You cannot view this
area, either because the area no longer exists, or because you do not
have the rights to view this area. To change your rights, contact the
site administrator" message.

Here's my submit code, oldPassword and newPassword are TextFields.
public void changePassword(object sender, EventArgs e)

{

SPWeb web = SPControl.GetContextWeb(Context);

user = web.CurrentUser;

DirectoryEntry entry = new DirectoryEntry("LDAP://CN=" + user.Name +
",CN=Users,DC=intranet,DC=mitchellmadison,DC=com",

user.LoginName.Substring(9), oldPassword.Text);

entry.Invoke("ChangePassword", new object[]{oldPassword.Text,
newPassword.Text});

entry.Dispose();

}

What's happening here? Do I have to reload the user profile or something
when I change the password programmatically? More importantly, how can I
correct this?


Do you know someone who can help? Share a link to this thread on twitter, or facebook.

Tagged:          

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Changing passwords through a web part Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].