Forms Authentication in MOSS 2007: IFs and WHYs
Part 2 of 4: User Creation
As we have mentioned in Part 1, this paper is divided into four parts, where the second part focuses on user creation necessary for the database we have created in Part 1.
1. To start, open your Microsoft Visual Studio 2005 and create a new web site.
WHY WE CREATE A USER? Upon setting the authentication type of our portal from Windows to Form, our Primary Site Administrator, which is a Windows or an Active Directory Account, will no longer be recognized. Thus, we need this user in our proceeding items to replace our Primary Site Administrator.
2. Write the following lines before the <system.web> node of the web.config of our newly created web site:
<remove name=”PointMembership” />
<add name=”PointMembership” connectionString=”data source=Server Name;Integrated Security=SSPI;Initial Catalog=PointMembership” />
NOTE: Notice that the Initial Catalog is the database we have created.
3. Add the following lines inside the <system.web> node of the same web.config file:
<remove name=”PublishingMembershipProvider” />
type=”System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
<roleManager enabled=”true” defaultProvider=”PublishingRoleProvider”>
<remove name=”PublishingRoleProvider” />
type=”System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
IF OTHER MEMBERSHIP AND ROLE PROVIDER NAMES ARE USED? No setback! Only that we have to synchronize other settings in the proceeding steps with the names we have assigned for membership and role providers.
IF NO MEMBERSHIP AND ROLE MANAGER ARE CONFIGURED? Still no setback! By default, a database is created in the App_Data folder of our web site to store membership and roles information. Hence, even without configuring our membership and role settings, the default providers will automatically be captured: AspNetSqlMembershipProvider and AspNetSqlRoleProvider. But in this case, we need to synchronize other settings in the proceeding steps.
4. Save the additions we have made in the web.config file.
5. It time for us to use the ASP .NET Web Site Administration Tool to create a user. In the Website menu of our Visual Studio, click ASP .NET Configuration. Below is the illustration.
6. Upon clicking the ASP .NET Configuration, we will be prompted by the Home page of ASP .NET Web Site Administration Tool.
WHY USING ASP .NET WEB SITE ADMINISTRATION TOOL? Basically, this tool is designed to facilitate changes in the site configuration without having to manually edit the Web.config file, in this case the configuration file of the site we have created and not the portal we will be creating. In our case, however, we use it to create a user and role for the corresponding membership and role providers which we will be using later in our portal. Even the web site we have created in the previous steps has nothing to do with our portal. It is simple our way to access this tool.
NOTE: The “How do I use this tool?” link would give us a comprehensive understanding of ASP .NET Web Site Administration Tool.
7. Click Security tab, and to create a user, set the Authentication Type, click Back, and we will be redirected again to the Security page with a link to user creation page. Below is the illustration.
WHY SETTING THE AUTHENTICATION TYPE? The authentication type we have just set is configured for the web site we have created and has nothing to do with the portal we will be creating. We have only set it to access the Create User link, which is the very purpose of using this tool.
8. Click the Create User link, complete necessary information, then click Create User. With that, we have already created a user which will serve as the Primary Site Administrator in our later steps.
End of Part 2 of 4