Problem with custom membership using MembershipDataProvider
Hello,
I am using sitefinity 5.1.3450 , and I created an membership provider inheriting from Telerik.Sitefinity.Data.MembershipDataProvider , I followed instructions in another forum thread from one of telerik's staff and did what he stated as nececary :
1.Implemented all abstract methods ,
2.Registered provider through backend.
This provided enough for sitefinity to know about my provider.
But the methods CreateUser(string) and CreateUser(Guid,string) didn't provide enough for registration in my provider so I overrided CreateUser(string,string,string,string,string,bool,object,out MembershipCreateStatus) , UserExists(string) , EmailExists(string) and successfuly registrated users through the backend(they were created in my base) but a number of problems occured :
1. You cannot delete users.
2. You cannot assign users to Roles.
3. You cannot edit user profiles ( it does not fill any of the information even createtime )
Code for CreateUser(lots of arguments) and my ManagerInfo property
( the this.GetManagerInfo(typeof(Telerik.Sitefinity.Security.UserManager).FullName, this.Name) way of getting manager info throws an exception about an decorator )
private Telerik.Sitefinity.Model.ManagerInfo managerInfo;
public Telerik.Sitefinity.Model.ManagerInfo ManagerInfo
get
if (this.managerInfo == null)
this.managerInfo = new Telerik.Sitefinity.Model.ManagerInfo()
ApplicationName = this.ApplicationName,
ManagerType = typeof(Telerik.Sitefinity.Security.UserManager).FullName,
ProviderName = this.Name,
Id = Guid.NewGuid()
;
return this.managerInfo;
public override User CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status)
User result;
bool create = true;
string notImplementedValidQuestion = "This question is valid";
string notImplementedValidAnswer = "This answer is valid";
if (!ValidateParameters(ref username, ref password, ref email, ref notImplementedValidQuestion, ref notImplementedValidAnswer, ref providerUserKey, out status))
create = false;
if (!create)
result = null;
else
CustomUser meCustom = new CustomUser()
ApplicationName=this.ApplicationName,
Id = (Guid)providerUserKey,
Password = this.EncodePassword(password, string.Empty, this.PasswordFormat),
Email = email,
PasswordAnswer = passwordAnswer,
IsApproved = isApproved,
;
meCustom.SetPasswordQuestion(passwordQuestion);
meCustom.SetUserName(username);
meCustom.SetCreationDate(DateTime.Now);
meCustom.SetIsLockedOut(false);
status = MembershipCreateStatus.Success;
result = store.Save(meCustom);
result.ManagerInfo = managerInfo;
((IDataItem)result).Provider = this;
return result;
Hi Mihail,
The error "Item could not be saved" is a pretty general. The users service through an error but we can not find which is the problematic aria from the log file you have sent us. Would it be possible for you to send us your Sitefinity project and the provider's database in the support ticket you have opened? We will connect the project to our source code, make a deep investigation and find what is causing the problem.
Regards,
Stefani Tacheva
the Telerik team