Open imtiazahmeddahar opened 4 years ago
At the moment DynamicRoleBasedAuthorizationNETCore
only supports MVC
not Razor Pages
and sorry for that. The main problem is that I cannot figure out how to get a page URL because it's related to the folder structure and I don't have much experience with Razor Pages
. I should spend more time on Razor Pages
and find out how routing exactly works or if someone can help me with this case.
i found filters for razor pages from Microsoft's docs but i don't know how to implement it. Would you like to please review it?
Filter methods for Razor Pages in ASP.NET Core: [https://docs.microsoft.com/en-us/aspnet/core/razor-pages/filter?view=aspnetcore-3.1]
@imtiazahmeddahar Ok sure, I'll guide you on how to implement dynamic auth in Razor Pages
.
Hi mo-esmp. Firstly thanks for the great repo.
I have followed your manual branch implementation in a project I'm using but also ran into the razor page issue as I'm using idenitiy scaffolded pages.
Could you please post your suggestions / guide for implementing the fix for razor pages?
Hey @shaunVorster, Sorry for the late reply. As I mentioned in previous comments, the main problem with Razor Pages for me is routing and couldn't find a solution for that and I haven't worked on it in a long time. For now, my suggestion is to take a look at the MvcControllerDiscovery to find out how it find controller actions and also take a look at this.
Hey @mo-esmp. Thanks very much for the reply. I will check it out.
i have created new MVC core 3.1 application with razor identity. when i run the application and i'm getting this error:
InvalidCastException: Unable to cast object of type 'Microsoft.AspNetCore.Mvc.RazorPages.CompiledPageActionDescriptor' to type 'Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor'. SchoolManagementSystem.ExtentionMethods.DynamicAuthorizationFilter.IsProtectedAction(AuthorizationFilterContext context) in DynamicAuthorizationFilter.cs, line 66
please guide me, how can i implement DynamicRoleBasedAuthorizationNETCore in razor pages as well.