SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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


$w = Get-SPWeb http://[your_url_here]
$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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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