Last post Apr 29, 2020 09:44 AM by Sean Fang
Apr 27, 2020 07:33 PM|shajigeorge|LINK
I am trying to update just the 'Comments' property in ASP. NET MembershipUser and want to leave all other property untouched. Here is my codes
MembershipUser userComments = Membership.GetUser(sUserName);
userComments.Comment = "Need Change Password";
It throws an expection 'The E-mail supplied already exists in the database for the application' at Membership.UpdateUser(userComments);
How can I just update only the 'Comments' without changing emails or any other properties?
Apr 29, 2020 09:44 AM|Sean Fang|LINK
It seems like the exception should be thrown by Membership.CreateUser() rather than UpdateUser().
The UpdateUser method will only throw ArgumentNullException and the CreateUser method will be able to give a MembershipCreateUserException which
contains MembershipCreateStatus Enum. In the enumeration, you could find below code and status.
The email address already exists in the database for the application.
The provider user key already exists in the database for the application.
The user name already exists in the database for the application.
The password answer is not formatted correctly.
The email address is not formatted correctly.
The password is not formatted correctly.
The provider user key is of an invalid type or format.
The password question is not formatted correctly.
The user name was not found in the database.
The provider returned an error that is not described by other MembershipCreateStatus enumeration values.
The user was successfully created.
The user was not created, for a reason defined by the provider.
Could you please share the detailed error/exception message?
Moreover, if you are using forms authentication with membership, I suggest you use ASP.NET Identity. According to Microsoft, the former ASP.NET Membership has been replaced with ASP.NET Identity.
Hope this can help you.