2

I've created an anonymous blog subsite. My root site is also anonymous. I can access default.aspx anonymously, but not /Lists/Posts/Post.aspx?ID=1

I've tried breaking permission inheritance and have tried toggling on all anonymous access options within the Comments list and even the Posts list. When navigating to these lists, I get a 401 Unauthorized error message.

Am I missing something?

1 Answer 1

1

Below is the solution, however the issue of anonymous users being able to see draft items has cropped up...

SPList list = curWeb.Lists["Comments"];
// check if it has unique permissions
if (!list.HasUniqueRoleAssignments)
{
    list.BreakRoleInheritance(true);
}
// make sure people logged in can edit their own items
list.WriteSecurity = 2;
// turn on moderation
list.EnableModeration = true;
list.DraftVersionVisibility = DraftVisibilityType.Approver;
// grant permissions to anonymous users
list.AnonymousPermMask64 =
  (SPBasePermissions.Open |
   SPBasePermissions.OpenItems |
   SPBasePermissions.ViewFormPages |
   SPBasePermissions.ViewListItems |
   SPBasePermissions.AddListItems);
list.Update();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.