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 know that you can specify the Membership provider and Role manager for a web application on creation, but I need to update it after creation. any clue.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

These settings are stored in Web.Config file. Use following techniques to work with web.config files in SharePoint world.

Working with Web.config Files

How to: Add and Remove Web.config Settings Programmatically

It is important to update the config files the "sharepoint way" so that the changes can be applied to all Web Servers in the farm.

share|improve this answer
    
thanks for the suggestion,, but what's the SharePoint way (Code or Powershell). –  Bassel Alkhateeb Jul 24 '11 at 6:51
    
I don't think it's actually in Web.config,, if you try creating a new web application and set it's Membership provider while creating it (In Central Admin) you won't find this provider in web.config of the web app. –  Bassel Alkhateeb Jul 24 '11 at 7:01
    
I meant using SpwebconfigModification object no matter code or powershell. –  Ashish Patel Jul 24 '11 at 15:33
    
so If I didn't enter the Membership setting from the Central Admin and just set it in web.config it will work? –  Bassel Alkhateeb Jul 25 '11 at 16:57
    
It works because ultimately what matters is the content of web.config and not the how it was entered. But I prefer to use as outlined in links above because it takes takes care of multiple servers in the farm. –  Ashish Patel Jul 25 '11 at 17:47
add comment

You will find entries similar to the following in the section of the web.config for your web application or in the root web.config if you configured FBA at the IIS root. You can change the name(s) directly in the web.config file.

    <roleManager>
        <providers>
            <add name="FBARoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" applicationName="/" connectionStringName="FBA" />
        </providers>
    </roleManager>
    <membership>
        <providers>
            <add name="FBAMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" applicationName="/" connectionStringName="FBA" enablePasswordReset="true" enablePasswordRetrieval="true" passwordFormat="Clear" requiresQuestionAndAnswer="true" requiresUniqueEmail="false" />
        </providers>
    </membership>
    <profile>
        <providers>
            <add name="FBAProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" applicationName="/" connectionStringName="FBA" />
        </providers>
    </profile>

If you don't see these entries in the web.config for your web app, look in the web.config file found in your .NET CONFIG folder (i.e. C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG)

share|improve this answer
add comment

As a side note, you can also set the membership and role provider when you extend an application.

You could just delete the IIS site from the application management, and then create the default zone again, specifying the membership and role providers.

You still need to modify the web.config, though. There's no escaping that.

share|improve this answer
add comment

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.