Take the 2-minute tour ×

How do we make the pages what we created using Visual Studio inherit permissions?

They work fine when the person is signed on, but when they are anonymous, you cannot access the pages.

How do I get them to be visible for anonymous users?

Thank you.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

I assume that by saying

pages what we created using Visual Studio

you mean application pages created in Visual Studio and deployed to _layouts directory. If you want to make such page anonymous, you have to change base class in your code behind. By default, application pages inherit from LayoutsPageBase class, and you have to change it to UnsecuredLayoutsPageBase and you have to override property AllowAnonymousAccess to return true:

public partial class ApplicationPage1 : UnsecuredLayoutsPageBase
    protected override bool AllowAnonymousAccess 
            return true;      

    protected void Page_Load(object sender, EventArgs e)

Of course your web application also must have anonymous access enabled.

Creating a SharePoint Application Page for Anonymous Access

share|improve this answer
Yup. This worked. Thank you. –  Diana Mar 19 '13 at 23:42
add comment

Start at the web application and continue to the appropriate level. Here is the PowerShell commands. (I assume you can Bing for steps in the user interface.)

Web Application:

$wa = get-spwebapplication http://[your_url_here]
$zone = [Microsoft.SharePoint.Administration.SPUrlZone]::WhicheverApplies
$i = $wa.IisSettings[$zone]
$i.AllowAnonymous = $true


$w = Get-SPWeb http://[your_url_here]
$w.AnonymousState = [Microsoft.SharePoint.SPWeb+AnonymousState]::On // or Enabled for lists & libraries only


$l = $w.Lists["List_Name"]
$l.AnonymousPermMask64 = {BasePermissions as appropriate}
share|improve this answer
Is this different from adding anonymous access through Site Actions -> Site Permissions -> Anonymous Access? –  Diana Mar 19 '13 at 22:19
add comment

Your Answer


