Sunday, March 22, 2009

FBA: Create and enable FBA Database

Steps:

1. Under the C:\Windows\Microsoft.Net\Framework\v2.0.50727 folder, run aspnet_regsql -S servername -A all -E > press Enter

2. Go to C:\Inetpub\wwwroot\wss\VirtualDirectories\windowsauthenticationappfolder, make a copy of the web.config file and edit the web.config file

3. Go to system.web tag, replace the <system.web> tag with the following:


<connectionStrings>

<remove name="AspNetSqlProvider" />

<add name="AspNetSqlProvider" connectionString="Data Source=servername;Initial Catalog=aspnetdb;Integrated Security=SSPI;Persist Security Info=False;" />

</connectionStrings>

<system.web>

<membership defaultProvider="AspNetSqlMembershipProvider">

<providers>

<remove name="AspNetSqlMembershipProvider" />

<add connectionStringName="AspNetSqlProvider" passwordAttemptWindow="10" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="partners" requiresUniqueEmail="false" passwordFormat="Clear" description="Stores and retrieves membership data from the Microsoft SQL Server database" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</membership>

<roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">

<providers>

<remove name="AspNetSqlRoleProvider" />

<remove name="AspNetWindowsTokenRoleProvider" />

<add applicationName="partners" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

<add connectionStringName="AspNetSqlProvider" applicationName="partners" description="Stores and retrieves roles data from the local Microsoft SQL Server database" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers>

</roleManager>



4. Replace the </configuration> with the following:

<system.net>

<mailSettings>

<!-- use your mail settingst here -->

<smtp deliveryMethod="Network" from="test@test.com">

<network host="smtp-server" port="25" />

</smtp>

</mailSettings>

</system.net>

</configuration>


5. Go to C:\Inetpub\wwwroot\wss\VirtualDirectories\fbaappfolder, make a copy of the web.config file and edit the web.config file, make the same change as above.

6. Copy the FBA tools to C:\Inetpub\wwwroot\wss\VirtualDirectories\windowsauthenticationappfolder as well as C:\Inetpub\wwwroot\wss\VirtualDirectories\fbaappfolder

7. Run iisreset /noforce

8. Go to your windows authentication site, run the FBA tools and add a user with username and password.

9. Go to People and Groups > Select the e.g. the Visitor Group > New > get the username just added > give permission to the account > click OK, so this user has been added to the windows authentication site successfully.

10. Go to the FBA site, it shoule allow you to see the home page since we enabled the anonymous access previously.

11. Click Sign In > type in the user you have just created in the windows authentication site (default zone) > Click Sign In > Now you are logged in as that user > you can then access the FBA tool to recover your password, it will send the password to you via email.

12. If you encounter an error in the recover page, you can change the customErrors's mode to RemoteOnly in the web.config and run iisreset /noforce to investigate.

13. Go to Central Admin > Application Management > Application Security > Authentication Providers > click on Extranet > uncheck Enable anonymous access > click Save > do the same for the default windows zone.

blog comments powered by Disqus