From 7a4872495b488903bc4d6019778da4621680cf3a Mon Sep 17 00:00:00 2001 From: Guilherme Oenning Date: Fri, 2 Oct 2020 22:21:23 +0100 Subject: [PATCH] Fixes filter order (#20073) * fix url * fix order --- aspnetcore/mvc/controllers/filters.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aspnetcore/mvc/controllers/filters.md b/aspnetcore/mvc/controllers/filters.md index 4410f3dc4a..b667e95f56 100644 --- a/aspnetcore/mvc/controllers/filters.md +++ b/aspnetcore/mvc/controllers/filters.md @@ -205,7 +205,7 @@ The `TestController`: -Navigating to `https://localhost:5001/Test2/FilterTest2` runs the following code: +Navigating to `https://localhost:5001/Test/FilterTest2` runs the following code: * `TestController.OnActionExecuting` * `MySampleActionFilter.OnActionExecuting` @@ -244,8 +244,8 @@ The 3 filters run in the following order: * `MySampleActionFilter.OnActionExecuting` * `MyAction2FilterAttribute.OnActionExecuting` * `Test2Controller.FilterTest2` - * `MySampleActionFilter.OnActionExecuted` - * `MyAction2FilterAttribute.OnResultExecuting` + * `MyAction2FilterAttribute.OnResultExecuting` + * `MySampleActionFilter.OnActionExecuted` * `Test2Controller.OnActionExecuted` The `Order` property overrides scope when determining the order in which filters run. Filters are sorted first by order, then scope is used to break ties. All of the built-in filters implement `IOrderedFilter` and set the default `Order` value to 0. As mentioned previously, controller level filters set the [Order](https://github.com/dotnet/AspNetCore/blob/master/src/Mvc/Mvc.Core/src/Filters/ControllerActionFilter.cs#L15-L17) property to `int.MinValue` For built-in filters, scope determines order unless `Order` is set to a non-zero value.