Anonymous access to a SharePoint site root - sharepoint

I have configured anonymous access on a SharePoint site for "Lists and Libraries". I then enable anonymous access to the individual lists/libraries as per my requirements.
This works great, but I cannot access the root site URL where I expect to be redirected to the welcome page:
Access to http://servername fails with Access Denied
Access to http://servername/Pages/Default.aspx succeeds
If I set the web permissions to "Entire Web Site", I can access the root URL, but I don't want to do this.
I am provisioning my site with a site definition and modifying the site through the object model during feature activation e.g.
web.AnonymousPermMask64 = SPBasePermissions.Open;
web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.Update();
... this is the code I'm already using with success.
Does anyone know how to allow anonymous access to http://servername?

It turns out you need to grant the following permission mask on the web object:
web.AnonymousState = SPWeb.WebAnonymousState.Enabled;
web.AnonymousPermMask64 = SPBasePermissions.Open | SPBasePermissions.ViewPages;
web.Update();
Simple really! Anonymous users can now navigate to http://servername and get redirected to the welcome page.
Note: the order of these two properties being set is important. Setting the AnonymousState property to Enabled, sets the permission mask to SPBasePermissions.Open only. This would remove the SPBasePermissions.ViewPages flag if you switched the order of the two properties as shown above.

You need to enable Anonymous access on the Pages library so that you have access to the default.aspx page.

Related

Kentico Permissions - Page requiring authentication not considered a secure area

I'm setting up a secure area of a site and I'm curious about how Kentico (version 11) checks permissions. According to the documentation -
Check page permissions
Indicates if the website should check the user permission settings of pages and apply them.
The following values are possible:
All pages - permissions will be checked for all pages on the website.
No page - permissions will not be checked for any pages.
Secured areas - permissions will be checked only for pages that are configured to require authentication.
This seems to indicate that if a page is set to require authentication, the page permissions will be checked. However, if my site is set with Settings -> Security & Membership and set Check page permissions to Secured areas, members in Groups that don't have permissions are able to access the page.
If we edit the settings to Settings -> Security & Membership and set Check page permissions to All pages, the users are appropriately denied access.
We would prefer not to check page permissions on every page for performance reasons. I can create a control to check the permissions of the page but I was curious if there was some reason why setting the page to require authentication and checking permissions for secured areas doesn't work the way the documentation indicates it would.
I can guarantee you from a performance standpoint you won't notice a difference. If you want it to check permissions, you WILL NEED to have that site/global setting checked, there is no way around it.
If you have that global setting checked and it's denying access to everyone, then you don't have your permissions set properly at the root level. At the root level, there should be no permissions set. Then at your /members-only page, add the role "Authentiated users" and below that box, then check the Read box under the Allow column. This is the simplest setup for permissions you can have for a test case.

Grant read permission on List for Anonymous user for public facing site in Sharepoint 2013 Online

I have a public facing SP site ( SP online 2013 with Office 365 ). There are certain app parts added to it which read data from a custom list created on that site. By default anonymous users do not have read permissions list. I want users to see the list data without login in . I tried modifying the settings for anonymous users , however I am unable to do it as the "anonymous user" permissions cannot be checked by me.
How do I provide read permissions to anonymous users?
Thanks in advance
If i remember rightly enabled anonymous access on the list simply allows users who aren't authenticated to view the list. However they won't be able to access the list directly on the interface as you would need to be authenticated for that. If the list is accessed directly from a web part or user control then you simply need to ensure the page which contains the control is published and your site available as anonymous access.

Sharepoint Anonymous Access and Custom User Permissions for a page

In sharepoint 2007 how can i give custom user permissions to a page where anonymous access is enabled for its parent site?
This page must be anonymously accessible but editable by only selected domain users. I cannot set permissions on page's parent site because in the same site, different pages must be editable by different people, though i have to set permissions on pages. But when I break the permission inheritance on the pages in order to give custom permissions to users, anonymous access is not working.
Where do you break the permission inheritance? On site, list or folder in the list level? Anyway if you break the permission inheritance somewhere within the list or library you should try to set the anonymous permission mask of the SPList instance (see here for a reference: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splist.anonymouspermmask.aspx).
I have been working with a scenario similar to yours with 2007 and did not have any problems...

Granting Access to custom page?

I have a custom sharepoint page that inherits from a custom dll I created
the page is located inside my shared documents library.
I managed the page's permissions so that there are two groups who can access it: one with a Full control level and the other with Contribute level.
the problem is that any member from the second group (with Contribute security level) tries to access the page, the unauthorized login page appears and the user cannot browse the page.
while any user from the first group (with Full Control) level can access the page normally.
so is there something missing that make custom pages only accessible by Full Control Users ? and is there any thing that can be done in the code to fix this ?
thanks
I doubt that you have written some code in this page that can not be performed with contribute permission level. So please try to access this page after commenting all the code you wrote in this page or create a new page with out any code. If you could access it with contribute permission level please use impersonation in your code.

Adding items to anonymous lists via code

We have a custom list inside a moss publishing site that an asp.net form is submitting information to.
We seem unable to submit the form when accessing the site anonymously, though we have turned off viewformspageslockdown, have enabled anonymous access on the site and allowed add anon on the list itself.
We can navigate to the list and add a new item from the moss gui but from our asp.net page, when we submit, it redirects to the login page.
Anonymous Means Read-Only, If you want to enable the user to add items while in Anonymous you need to use the SPSecurity.RunWithElevatedPrivileges in the ASP.NET Page code.
You will need to check the security on the Custom List to ensure that the anonymous users can modify the list items. You should be able to check the effective security in site administration.

Resources