开发者

Adding a user from a SharePoint 2010 web part

开发者 https://www.devze.com 2023-02-18 01:04 出处:网络
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

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 an开发者_高级运维yone have any ideas or any experience using a custom membership provider from a web part?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号