I have created custom attribute as:
[System.AttributeUsage(System.AttributeTargets.All, AllowMultiple = true)]
public class CustomPermission : Attribute
{
public CustomPermission (string perName)
{
this._name= perName;
}
protected String _name;
public String Name
{
get
{
return this._name;
}
}
}
I have this attribute on my method as:
[CustomPermission("Allowed")]
public void GetData()
{
//only comes here if permisson is allowed
//logic for db
}
I want whenever a call is made to GetData it automatically checks for the CustomPermission attribute over the method and accordingly grants/deny access.
How can I do that?
Thanks