Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my asp.net application , I need to implement event based authorization. For example , In a page add,edit and delete buttons are there. There are different types of roles are defined. The role has permission to view the page but inside that page whether user can add or delete or edit the record will depend on the rights given to that role. For example , there is a role with name Auditor and only Add button permission are assigned to this role. Now if a user with role Auditor access a page which has Add,Edit and Delete buttons then this user should be able to Add records only.
Simply , I want to define the name of the event for a button and want to control this event through the permission assigned to a role.
Can you suggest me the best way to achieve it.

What I have tried:

Searched the web but did not find answer
Posted
Updated 18-Nov-17 5:12am

1 solution

The simplest way is to show and enable only buttons that can be executed by the user that is in the specified role when the page is loaded.
 
Share this answer
 
Comments
Member 2306433 18-Nov-17 11:25am    
by this way,on every page load,we have to write code like this, if DeleteRight==true then btnDelete.Enable=true. this is the basic code. but i want to control this from a class file which will be inherited by every page.i will define the event name for the button and that base class will do rest of the things. means i dont want to write the code one every page .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900