Is it possible can we do this in webapi
[Authorize(Roles=//set dynamically)]
Hi Krishna@12,
Refer below links.
https://stackoverflow.com/questions/44794736/dynamic-authorization-of-roles-asp-net-core
https://codinginfinite.com/dynamic-role-based-authorization-asp-net-core-assign-database/
https://www.codeproject.com/Articles/1248792/Dynamic-Role-Based-Authorization-in-ASP-NET-Core
As per my project i have 15 business roles, Each role assigned to one user and web api controller level . i need to dynamically all this role for authrization
No it is not possible.
Refer below link for alternate implementation.
https://forums.asp.net/t/2070391.aspx?Authorize+dynamically+roles+for+Controller+API+in+ASP+NET+5+1+0+0+beta7+
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.