---
title: Checking page permissions
related:
  - https://docs.kentico.com/k12sp/developing-websites/retrieving-content-in-mvc-applications.md
  - https://docs.kentico.com/k12sp/managing-users/configuring-permissions/configuring-page-permissions/page-level-permissions-acls.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

You can control which [users](https://docs.kentico.com/k12sp/managing-users/user-registration-and-authentication/integrating-kentico-membership.md) and [roles](https://docs.kentico.com/k12sp/managing-users/role-management.md) can view pages on the live site by configuring [page-level permissions](https://docs.kentico.com/k12sp/managing-users/configuring-permissions/configuring-page-permissions/page-level-permissions-acls.md) and extending the [document query](https://docs.kentico.com/k12sp/custom-development/working-with-pages-in-the-api.md) that [retrieves page content](https://docs.kentico.com/k12sp/developing-websites/retrieving-content-in-mvc-applications.md) with a **CheckPermissions** call. The method ensures the retrieved collection only contains pages for which the current user has the **Read** permission.

1. Open the **Pages** application and select the page for which you wish to set permissions.
2. Configure the page's [page-level permissions(ACLs)](https://docs.kentico.com/k12sp/managing-users/configuring-permissions/configuring-page-permissions/page-level-permissions-acls.md).
3. Click **Save**.

Next, modify the controller action that handles the retrieval of content from Kentico:

1. Open your MVC project, and navigate to the controller that retrieves page content.
2. In the controller action, extend the document query expression by adding the _CheckPermissions_ method. We recommend using provider classes [generated](https://docs.kentico.com/k12sp/developing-websites/generating-classes-for-kentico-objects.md) by the system to retrieve content from Kentico.

   ```csharp

   // Gets the specified articles using the generated provider and checks their page permissions
   IEnumerable<Article> articles = ArticleProvider.GetArticles()
       .OnSite("MySite")
       .Culture("en-US")
       .Path("/Articles/", PathTypeEnum.Children)
       .CheckPermissions();

   ```
3. Build the MVC project.

Only the specified users can now view the content of the page on the live site. Users who do not have the required permission see a [page not found error](https://docs.kentico.com/k12sp/securing-websites/developing-secure-websites/handling-error-messages-securely/handling-404-errors-in-mvc-applications.md).

> **Note:** **Note**: By default, the permission matrix is blank for all pages, meaning users are forbidden from all actions (for example, reading or modifying page content).
