Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a custom membership provider for FBA (SharePoint 2010).

My CustomMembershipProvider (+ role provider) are defined in the 3 web.config (CA, STS, webapp).

In web.config of webapp, I set applicationName of membership provider to CUSTOM. In other files, I set it to CustomMembershipProvider.

Url of webapp : http://dev2010:10000. When I reach this url, CustomMembershipProvider is initialized and value of applicationName is CUSTOM. Then I have to select in combo Windows or FBA authentication.

If I select FBA, then enter login/password, when I submit, CustomMembershipProvider is initialized again, with applicationName = CustomMembershipProvider!

Do I need to extend my web app, and remove FBA on http://dev2010:10000?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

The reason you're getting 'CustomMembershipProvider' instead of 'CUSTOM', is because the membership provider from the STS config file is used to login. Generally you define the same options for each membership provider of the same name in each of your web.configs. Is there a reason you're using different options?

share|improve this answer
    
Yes, I figured that by setting different applicationNames. I need different options because the custom membership provider connects to a database, and connection string is related to the web application... That's why I was thinking of using applicationName to identify "the" web app. I can't load anything from web.config, WebConfigurationManager doesn't give me access to the web.config of the current web app. –  Francois B. May 29 '12 at 19:30
    
The only way I figured out is to declare many time the same provider, but with a different name that contains name of web app... Then I can load web.config of the "good" web app. –  Francois B. May 29 '12 at 19:31
    
That is what you'll have to do - declare the same provider with a different name for each config. The STS and Central Admin web configs will have to contain all of these copies of the different provider configurations. –  Chris Coulson May 30 '12 at 16:46
  1. If you created your application already with Claims-Based (which it seems you did) there is no need to extend the application (as it was in MOSS 2007) but you must update in SP-CA the Providers (2 text boxes on the provider about Membership/Role). This besides properly updating all 3 web.config files (which it seems you did).
  2. The name of the MembershipProvider is different than the name of the Application - they do not actually represent the same thing (usually not needed to specify application name). The behavior you are experiencing seems OK, because in order to reach the initial authentication form, SharePoint needs to show a page that is under Forms Authentication itself (with Anonymous enabled) and the Provider model initializes all membership providers which it uses later.

Not sure if that clears your confusion but hope it helps!

share|improve this answer
    
Thanks. It helps to understand a little. But when I submit form with login/pwd (FBA), it's the "wrong" provider... in fact, I use applicationName to load the connectionString, and it's not the "good" one. –  Francois B. May 29 '12 at 9:23

For what it's worth, almost every walk-through I have ever seen or followed for configuring FBA in SharePoint 2010 has used / as the applicationName value wherever one needs to be specified. Do you have a compelling reason for specifying something other than the root application name?

Scott Guthrie has an awesome, detailed explanation of why setting the applicationName property is so important here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.