Friday 29 August 2014

Forms Based Authentication in Sharepoint 2007
I.)Create 2-sites (one for Default and second Internet application (Extended site))
1.) Open Central Admin
2.) Go to SharePoint Web Application Management Tab. & Click Create or extend Web application.
3.) In next page click on Create a new Web application You will get the following page . then enter port no, user name, password etc.



Continue..


4.) Click on Create Site collection


5.)Give Title for site collection:





6.) You can view your  site in new  window by clicking the URL.or To return to SharePoint Central Administration, click OK.
 
7.) Open Central Admin to Create Extended site.

8.)  Go to SharePoint Web Application Management Tab. & Click Create or extend Web application.




9.)Select Web Application(ie. Previously created site) and give port No for new extended site, select internet zone , Click OK


Now your Extended site for internet application is ready.

II.) FBA Configuration.
1.) Double click on aspnet_regsql.exe located at  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\

2.)Click next


3.) Give your SQL-server User name, Password and Type new Database name in database dropdown & Click next

4.) Click next

5.) Click next

6.) Click Finish & Open your Sql server Management studio. Then You can find your database is ready




7.) Next:  To  add an admin user open your visual studio and Create a new temporary asp.net website.




8.) Open web .config file and make changes as follows (Refer. Sction 1.1 (code) & Section 1.2 (Image)
[a.] Add connection string ( for database created above step) above the <system.web>.
[b.]Add membership provider below the <system.web>. Give connectionstring name /name etc. as shown in below screen-shot
[c] Add Role provider below the membership provider .Give connectionstring name /name etc. as shown in below screen-shot.
//------------------------------------- Sction 1.1 ---------------------------------------------------------
<!--ConnectionString STARTS-->
    <connectionStrings>
        <add name="New_FBAConnectionString"
             connectionString="Data Source=SYNTHESI-BJOKYP;Initial Catalog=New_ FBA;
             User ID=sa;Password=admin@1234" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <!--ConnectionString END-->   
    <system.web>
       
        <!--FBA MEMBERSHIP STARTS-->
        <membership defaultProvider="FBA_ ">
            <providers>
                <add connectionStringName="New_ FBAConnectionString" enablePasswordRetrieval="false"
                     enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/"
                     requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5"
                     minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1"
                     passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="FBA_ "
                     type="System.Web.Security.SqlMembershipProvider,System.Web, Version=2.0.0.0,
                     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </membership>
        <!--FBA MEMBERSHIP STARTS-->
       
        <!--FBA ROLLS STARTS-->
        <roleManager enabled="true" defaultProvider="FBA_RoleProvider2">
            <providers>
                <add connectionStringName="New_FBAConnectionString" applicationName="/"
                     name="FBA_RoleProvider2" type="System.Web.Security.SqlRoleProvider, System.Web,
                     Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </roleManager>
        <!--FBA ROLLS END-->
//------------------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------- Sction 1.2---------------------------------------------------------------------------------------

9.) Go to Website-->ASP.NET Configuration & click as shown below.





10.) Click on Select a different provider for each feature (advanced) as below

11.) Click to test your connection.




12.) You will get connection successful message.

13.) Go to Security tab and select Authentication type as below.


14.) Select “From the Internet and click Done.

16. ) Click Create user.





17.)Enter profile of your administrator and click create user .( Note: Password should have at-least one special character and one numeric and click create user)



18.) If you want to create more user click Continue otherwise close the browser.








19.) open web.config from of main(default)site and extended site from the path for eg. C:\Inetpub\wwwroot\wss\VirtualDirectories\1200  and C:\Inetpub\wwwroot\wss\VirtualDirectories\FBA1201 respectively.

Note: You can copy code from SerialNo.8 Section.1.1 & paste to both config file & modify required changes.


18.)Open web.config file of central admin. And do the following changes.(code & image are given below)
<!--ConnectionString STARTS-->
    <connectionStrings>
        <add name="New_FBAConnectionString"
             connectionString="Data Source=SYNTHESI-BJOKYP;Initial Catalog=New_FBA;
             User ID=sa;Password=admin@1234" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <!--ConnectionString END-->   
    <system.web>
       
        <!--FBA MEMBERSHIP STARTS-->
        <membership defaultProvider="FBA_2">
            <providers>
                <add connectionStringName="New_FBAConnectionString" enablePasswordRetrieval="false"
                     enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/"
                     requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5"
                     minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1"
                     passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="FBA_2"
                     type="System.Web.Security.SqlMembershipProvider,System.Web, Version=2.0.0.0,
                     Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </membership>
        <!--FBA MEMBERSHIP STARTS-->
       
        <!--FBA ROLLS STARTS-->
        <roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
            <providers>
                <add connectionStringName="New_FBAConnectionString" applicationName="/"
                     name="FBA_RoleProvider2" type="System.Web.Security.SqlRoleProvider, System.Web,
                     Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </providers>
        </roleManager>
        <!--FBA ROLLS END-->





19.) Go to Central admin  ->Application Management tab]
Application Security click Authentication providers  as below.




20.)Select your Default site. (eg.1200) and click on Internet.










21.) Select authentication Type to Forms, check Enable anonymous access, Give membership-provider name and Role manager name (as given in web.config of extended site(eg.1201) site) & save.



22.) After save check all sites are working (ie.
CentralAdmin,
Mainsite (eg. http:// bjokyp:1200/),
Extended site (eg. . http:// bjokyp:1201/)











23.)To add admin user and set anonymous access to Internet Site : Go to site action  site settings people and groupsHome Owner







24.) add admin name which was added in step 17.(ie. dmin)and use the people picker to check the availability.








25.)Login with ID and Password Which was Given in Step 17.




        
============= F B A Configuration Completed===================================