Skip to content

Custom ActionFilterAttribute on Razor PageModel Get method #2981

Closed
@fmaeseele

Description

@fmaeseele

Hi,

I'm trying to get a custom ActionFilterAttribute to get working on the Get method of my Razor Pages.
Starting with a simple .NetCore Web project, I created a custom ActionFilterAttribute as :

`
public class MyCustomActionFilterAttribute : ActionFilterAttribute
{
///


/// Title of the current item
///

public string Title { get; set; }

    public override void OnActionExecuting(ActionExecutingContext context)
    {
          // This method is NEVER called!!
        System.Diagnostics.Debugger.Break();
    }
}

`

Then I use it in my Index.cshtml.cs :

public class IndexModel : PageModel { [MyCustomActionFilter(Title ="My Title", Order =1)] public void OnGet() { } }

But the method OnActionExecuting is never called.
What am I missing ?

Regards.
François
TestCustomActionFilterAttribute.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions