Is there a way to apply an IPageFilter on a razor page which does not have a model?
The page is a simple get request.
@page
@{
@functions{
public void OnGet()
{
}
}
}
Just want to know If it's possible to add a simple i.e. Authorize attribute (or any IPageFilter attributes) in the above page. As the attributes work on following page when there exist a child class of PageModel.
@{
@functions
{
[Authorize]
public class TestModel : PageModel
{
public void OnGet()
{
}
}
}
}
You could use a page application model convention to add one. There’s an AddFilter convention extension that accepts a func
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With