I need to develop a role based control access system in my application
In my case I have
- aspx page
- XML file
- Custom role provider
each control in the aspx 开发者_高级运维page should have an extra behavior to be enable or not depend on the user role
so when the page is loaded the control that will be available to user are only the controls that each enable state meet the user role
The As Is state on my project that I develop in each page a function that check each control roles and user roles if muchs the control will be enable if not it will be disabled
I don't like this check even when I try to have a base class that all my pages inherited from and it manage this but also the same if-else techniq!!
So my should be is to find a solution to put a control in the page easy then I have some class that read XML file which I have and it contain controls IDs for each page with it's Role and those class handle the controls availability depend on each control rols that come from the XML file !
The page directly renderd with controls as it should be available or not for the current authonticated user
精彩评论