I've implemented custom membershipprovider and roleprovider I use with Forms auth on a Sharepoint site.
This works fine, and Sharepoint invokes methods on both custom providers without problems.
I'm trying to use Membership.CreateUser from a new aspx page deploye开发者_StackOverflowd to Sharepoint but this fails with "The membership provider name specified is invalid. Parameter name: providerName" (I've tried deploying the page under the \12 folder and in the content db for the site collection).
I've also tried invoking Membership.CreatUser from the custom roleprovider, and that also works fine.
The membershipprovider is configured in web.config and is default provider.
Do I need to do something special to access Membership from an aspx page deployed in Sharepoint
Custom pages deployed to _layouts don't use the web.config under inetpub. You most likely need to add the membership provider into the web.config in your _layouts/ folder (in the 12 hive) - best practices dictate that you create a subfolder like this: 12/TEMPLATES/LAYOUTS/(myapp)/mypage.aspx (web.config goes here too with your membership/role stuff configured).
Make sense?
-Oisin
精彩评论