Thursday, October 13, 2011

Allow anonymous access to SharePoint in the _layouts directory

Allow anonymous access to SharePoint in the _layouts directory


Allowing anonymous access

To do this we have to inherit from our page from "UnsecuredLayoutsPageBase" instead of "LayoutsPageBase". This is a base class for application pages that do not require the user to have any permissions.

  1. Open up [YourPgae].aspx.cs
  2. By default, the page is inherited from "LayoutsPageBase". Change the inheritance
    from "LayoutsPageBase" to "UnsecuredLayoutsPageBase".

    public partial class [YourPgae]: UnsecuredLayoutsPageBase

  3. Next, we need to override a property of the UnsecuredLayoutsPageBase, to allow the
    anonymous access. Be sure to change the 'getter' to return true

    protected override bool AllowAnonymousAccess { get { return true; } }

Deploy the solution


--
Shahzad Afzal
http://www.pakistanprobe.com/



No comments:

Popular Posts