Is it possible can we do this in webapi
[Authorize(Roles=//set dynamically)]
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.