Monday, January 5, 2009

DotNetNuke Code Snippet: Update user email


//update DNN User Email
string oldEmail = UserInfo.Email;
this.UserInfo.Email = txtEmail.Text;
UserController.UpdateUser(PortalId,this.UserInfo);
// Update User Email
MembershipUser oUser = Membership.GetUser(UserInfo.Username);
oUser.Email = txtEmail.Text;
Membership.UpdateUser(oUser);

//note: please assume you have a textbox with id txtEmail in your front end. you can
//take a static string email in place of txtEmail.Text

1 comment:

  1. thanks for this post
    i think in the same way but i forget
    // Update User Email
    MembershipUser oUser = Membership.GetUser(UserInfo.Username);
    oUser.Email = txtEmail.Text;
    Membership.UpdateUser(oUser);

    now i will try it and i think it will working good
    tanks

    ReplyDelete

Please add your valuable comments about this post if it helped you. Thanks