This post has been migrated from www.experimentsincode.com, we apologise if some of the images or content is missing

This post has been migrated, original date 18 Aug 2009 According to MSDN the class Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase, Microsoft.SharePoint should be used to give anonymous users access to page. However despite in inheriting from the class you might still get a 401 Unauthorised error. Not only do you need to inherit from this class but you also need to override the AllowAnnoymouseAccess property and set it to return true:
public class Login: Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase{
	 protected override bool AllowAnnonymouseAccess{
	 	 get{
	 	 	 return true;
	 	 }
	 }

}
I am not sure why this class needs this additional property but once added it worked fine.