I am trying to lock access to all the pages in selected Areas in my Razor Pages app. So far I have this sample structure
Areas
Account
Business
If I add
options.Conventions.AuthorizeFolder("/business", "/index");
to startup, it works on a per page basis, but I cant see any clear way to lock the entire Business folder. I've tried the folder based options mentioned here
https://learn.microsoft.com/en-us/aspnet/core/security/authorization/razor-pages-authorization?view=aspnetcore-3.0
but none seem to work. Is this even possible?
The difference between them is that View Pages are Razor views that are used to provide the HTML representations (aka views) for services in much the same way View Pages work for MVC Controllers.
you can do it in the client side, in javascript. Also create an anchor a set the asp-controller and asp-action and there you redirect. Or create an anchor a and hard code the path.
So 10 seconds after asking, this works
options.Conventions.AuthorizeAreaFolder("business", "/");
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