A page filter is an ASP.NET Core filter for Razor Pages. It changes a request before a page-handler method runs or changes the result afterward, and it can be attached to specific endpoints for reuse. section 30.3 section 30.8
IPageFilter defines three synchronous callbacks. OnPageHandlerSelected runs after handler selection but before model binding; OnPageHandlerExecuting runs after binding and before the handler; OnPageHandlerExecuted runs after the handler but before result processing. section 30.4.4
Changing a handler argument
A filter can implement IPageFilter and alter bound arguments before the handler runs: `public void OnPageHandlerExecuting(PageHandlerExecutingContext context) { if (context.HandlerArguments.ContainsKey("message1")) context.HandlerArguments["message1"] = "New message"; }`. Applying `[ChangePageArgs]` to the MessageModel page makes the handler receive the replacement value.
