1
votes

I am using a custom membership provider (forms auth) for SharePoint 2010. I am trying to build a web part that will allow an administrator to create a new account via my custom provider. I have code for this that runs perfectly in an ASP.NET application (external to SharePoint). Now, When I try to add a user from the web part:

        MembershipProvider mp = Membership.Providers["MyProvider"];
        MembershipCreateStatus status;
        mp.CreateUser(<USER INFO HERE>, out status);

It gives me a status of "Provider Error."

When I call "GetAllUsers," it throws the good old: {"Object reference not set to an instance of an object."}

Does anyone have any ideas or any experience using a custom membership provider from a web part?

1

1 Answers

0
votes

I don't know if this will change anything, but it's worth a try:

Did you specify your membership provider as the default provider in the web.config ? There should be a node <membership defaultProvider="i">...</membership>. In a default configuration i is the SPClaimsAuthMembershipProvider. Change the i to whatever name you've given your custom membership provider.