ASP.NET: Getting Permitted Roles for a Page

I have an ASP.NET site that uses a custom role provider to define authorization for different parts of the site. I configured authorized roles for different parts of the site in web.config.

If the user is not in a specific role, I would like to tell them what role they require in order to be able to access this part of the site so that you can receive an accurate authorization request and send it for approval.

Is there an easy way to check which roles can access this page on a site?

+3
source share
1 answer

Depending on the setting of your website, you can structure your websites in folders for each role. So you can look at the url to determine the role.

Having said that, I'm sure there is a way to programmatically find out what you set in the Location elements, but I don’t know, sorry :)

+1
source

Source: https://habr.com/ru/post/1714770/


All Articles