More in this section

Forums / Developing with Sitefinity / Problem with custom membership using MembershipDataProvider

Problem with custom membership using MembershipDataProvider

2 posts, 0 answered
  1. Mihail
    Mihail avatar
    2 posts
    01 Oct 2012
    01 Oct 2012
    Link to this post
    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
            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;
            CustomUser meCustom = new CustomUser()
                Id = (Guid)providerUserKey,
                Password = this.EncodePassword(password, string.Empty, this.PasswordFormat),
                Email = email,
                PasswordAnswer = passwordAnswer,
                IsApproved = isApproved,
            status = MembershipCreateStatus.Success;
            result = store.Save(meCustom);
            result.ManagerInfo = managerInfo;
            ((IDataItem)result).Provider = this;
        return result;

    Additional Info:

    The methods DeleteItem(object) and Delete(User) are not entered.No exception is thrown or written in the log when the user is not deleted.

    I get the following error in the Error.log when i create an user(NOTE! the user is still created in my database):

    10/01/2012 14:45:59
    Type : Telerik.Sitefinity.Utilities.MS.ServiceModel.Web.WebProtocolException, Telerik.Sitefinity.Utilities, Version=5.1.3450.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
    Message : ERROR: Item could not be saved.
    Source : Telerik.Sitefinity
    Help link : 
    StatusCode : InternalServerError
    StatusDescription : ERROR: Item could not be saved.
    IsDetailXhtml : True
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Telerik.Sitefinity.Security.Web.Services.WcfMembershipUser SaveUserInternal(Telerik.Sitefinity.Security.Web.Services.WcfMembershipUser, System.Guid, System.String, Boolean, Boolean)
    detailWriterInstance : Telerik.Sitefinity.Utilities.MS.ServiceModel.Web.WebProtocolException+StringDetailWriter
    Stack Trace :    at Telerik.Sitefinity.Security.Web.Services.Users.SaveUserInternal(WcfMembershipUser user, Guid userId, String providerName, Boolean update, Boolean updateRoles)
       at Telerik.Sitefinity.Security.Web.Services.Users.CreateUser(WcfMembershipUser user, String userId, String provider)
       at SyncInvokeCreateUser(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

    Additional Info:

    MachineName : (hidden)
    TimeStamp : 1.10.2012 г. 11:45:59 ч.
    FullName : Telerik.Sitefinity.Utilities, Version=5.1.3450.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
    AppDomainName : a6f13a54-6-129935649858876839
    ThreadIdentity : 
    WindowsIdentity : (hidden)
    Requested URL : http://localhost:60876/sitefinity/Services/Security/Users.svc/create/00000000-0000-0000-0000-000000000000/?provider=VA
    Category: ErrorLog
    Priority: 0
    EventId: 90000
    Severity: Error
    Title:Enterprise Library Exception Handling
    Machine: (hidden)
    App Domain: a6f13a54-6-129935649858876839
    ProcessId: 5044
    Process Name: C:\Program Files\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.exe
    Thread Name: 
    Win32 ThreadId:2996
    Extended Properties: 
  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    31 May 2017
    04 Oct 2012
    Link to this post
    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.

    Stefani Tacheva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered