dotnet / dotnet/AspNetCore.Docs

Clarification on the role of Filter Attribute when used in Folders

Open
#22,990 2 comments 0 reactions 0 assignees View on GitHub
doc-enhancement re-Aditya Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

This tutorial is great but there is something I am not sure if it is OK or bad practice.
I naively took the Filter Attribute and tried to use it globally in the `Movies`,

```
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages(options =>
{
options.Conventions.AddFolderApplicationModelConvention(
"/Movies",
model => model.Filters.Add(new AddHeaderAttribute("Author", "Rick")));
});
}
```
**And it works!**
Is that OK, and if so what would be the problem, if any, or limitation?
I am happy to update the docs to mention this, if that is an OK practice.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: f0646a3d-a5d1-d4b0-5494-fe38219d16c9
* Version Independent ID: 8b659e63-93b8-a496-bc9b-dce0d9fa8f3c
* Content: [Filter methods for Razor Pages in ASP.NET Core](https://docs.microsoft.com/en-us/aspnet/core/razor-pages/filter?view=aspnetcore-6.0)
* Content Source: [aspnetcore/razor-pages/filter.md](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/razor-pages/filter.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-razorpages**
* GitHub Login: @Rick-Anderson
* Microsoft Alias: **riande**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.