LinkedIn

Monday, October 3, 2011

Anonymous Access to Application Pages in Sharepoint 2010

Scenario:
How to make an application pages (_layouts page) in SharePoint anonymous?
Resolution:
Use the UnsecuredLayoutsPageBase as a base class for the application pages to which even unauthenticated users must have access, such as a login page.Additionally you need to override one more method AllowAnonymousAccess to return true and you are all set.
If the application page does not have code-behind, the below snippet will mark the property "AllowAnonymousAccess" to true:






public class ApplicationPage : Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase


{


protected override bool AllowAnonymousAccess { get { return true; }


}