Finally! I've got some time to take a really good look at MOSS :-) Along the way, I've been jotting down notes. Thought I'd just post them here so that in case if I forget to bring along my files, the information is right here on my blog.
Steps to get Forms Authentication working with the ASP.NET SQL provider:
1. Install the Application Services Database for SQL Servera. Select
Start > All Programs > Microsoft Visual Studio 2005 > Visual Studio Tools > Visual Studio 2005 Command Prompt.
b. Enter:
aspnet_regsql.exe -E -A all -S localhost\DatabaseServerNamec. Wait while features are added to the local SQL dataase
More details on the aspnet_regsql utility here:
http://msdn2.microsoft.com/en-us/library/x28wfk74.aspx2. Add the First UserThe database has been created. However, it does not
contain any users and threfore we won't be able to log in. There are at least two ways to add a user. We could write a script, or we could access the ASP.NET Web Site Administration
Tool.
[Update 27 Feb 2007] After a few tries, I find that writing a script is a lot easier and faster.
Option 1: Adding Users by ScriptSimply run the following query in Microsoft SQL Management Studio against the aspnetdb database.
declare @now datetime
set @now= GETDATE()
exec aspnet_Membership_CreateUser 'appName', 'userid','password','','email@somewhere.com','','',1,@now,@now,0,0,null
Details on the structure of this script is available on
MSDN.
Option 2: Adding Users by Creating a Web Applicationa. Create a new web application.
b. Add the connection string between the
<configuration>tags of the web.config file.
c. From Visual Studio, select Website ASP.NET Web Configuration.
d. Click Security Create User. Add the name of the user. Later on, we will configure this user to be the site administrator.
3. Modify the web.config file
a. Open the web.config file located in the C:\Inetpub\wwwroot\wss\VirtualDirectories\GUID
folder. To determine the exact location, open IIS and check the home directory of the SharePoint site.
b. Add the following connection string between the <configuration>tag:
c. Add the provider details between the <system.web>tag:
d. Repeat steps (a)-(c) for the SharePoint Central Administration v3 website. We'll need the central administration site to work with forms authentication so that we can add the first administrator of the site. It is important to perform this step, otherwise you won't be able to add the first forms-based administrator later.
Warning! Check for typos. A single mistake may result in hours of troubleshooting!
[27 Feb 2007] One problem that I've had was mismatch of the applicationName field. It's got to be the same as the one used within the SQL script or SharePoint won't be able to match the users.
4. Configure the SharePoint site for forms authentication
a. Select Start SharePoint Central Administration
b. Click Application Management.
c. In the Appliation Security section, click Authentication providers.
d. Check that you are working with the web application that you wish to configure Forms Authentication for.
e. Click Windows.
f. Set the the following fields:
- Authentication Mode = Forms
- Membership provider name = AspNetSqlMembershipProvider.
g. Click Save
5. Assign the user to be a site collection administrator.
a. In SharePoint Central Administration Application Management, click Site Collection Administrators (you can find it in the SharePoint Site Management section).
b. Add the user as the site collection administrator of the website in which forms authentication will be applied.
And we're almost done. There are a couple more things such as granting anonymous users access to sections of the site. Also, we probably want employees on the intranet to use their windows account to log on to the site. I'll write a little about these topics in future articles.
[Update 27 Feb 2007] I've corrected some of the code errors. Blogger ate up the angled brackets and some of the mixed cased tags became lower case. To get around this, I've converted all the code to images and (hope) to post the snippets to my Y! briefcase for downloading soon. Labels: forms authentication, moss