Tuesday, July 25, 2006

Part 2 - Enabling Anonymous Access

Earlier, I wrote a about how to implement forms authentication for a SharePoint 2007 Beta2 site. Typically, you would probably not want to apply authentication to the entire web site. You may want, for example, to allow anonymous users to view the home page.

Here's how to turn on anonymous access:

1.Enable anonymous access on the top-level web site:
a. Select Start > SharePoint 3.0 Central Administration
b. Click Application Management
c. In the "Application Security" section, click Authentication Providers.
d. Select the web application to work on.
e. Click ASpNetSqlMembershipProvider
f. Check the Enable Anonymous Access checkbox.
g. Click Save

2. Enable anonymous access at the site level
a. Navigate to the web site. You will be prompted for a user id and password. Login as the adminstrator.
b. Goto Site Actions> Site Settings > Modify All Site Settings
c. In the Users and Permissions column, choose Advanced Permissions.
d. From the menu, choose Settings > Anonymous Access




e. You could choose to allow guest users to view only lists or the entire web site. Choose to enable anonymous access on the entire web site.



3. Delete the authentication cookie
a. Select Tools > Internet Options
b. Click Delete Cookies

And the next time you open your page, you won't have to login to view the front page. To prevent anonymous users from viewing sub sites, repeat step 2 for each sub site but choose "Nothing" instead.

Friday, July 21, 2006

Implementing Forms Authentication in MOSS Beta 2 with the ASP.NET SQL Provider - Part 1

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 Server
a. 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\DatabaseServerName

c. 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.aspx

2. Add the First User
The 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 Script

Simply 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 Application
a. 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: ,

Thursday, July 13, 2006

Installing MOSS - Just some random notes

Just jotting down some random notes on installing a standalone version of MOSS 2007 Beta2 on a Windows 2003 Server.

1. Error Message: This product requires ASP.Net web server extensions to be enabled in Internet Information Services (IIS). Enable this setting and re-run setup.

Solution that worked:
a. Ensure that ASP.NET 2.0 has been installed. (Check list of programs in Add/Remove programs)
b. In IIS, choose Web Server Extensions and ensure that ASP.NET 2.0 is allowed (by default, it is prohibited).



2. Error Message: Failed to create the configuration database. An exception of type Microsoft.SharePoint.SPException was thrown. Additional exception information: The language is not supported on the server.

Solution that worked: Matthew Cosier has hit the nail on the head with this one: http://mcosier.blogspot.com/2006/05/language-is-not-supported-on-server.html