title: Custom attribute and execute method
body: <p>I have created custom attribute as:</p>
  
  <pre><code>[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;
          }
      }       
  }
  </code></pre>
  
  <p>I have this attribute on my method as:</p>
  
  <pre><code>[CustomPermission("Allowed")]
  public void GetData()
  {
     //only comes here if permisson is allowed
     //logic for db 
  }
  </code></pre>
  
  <p>I want whenever a call is made to GetData it automatically checks for the CustomPermission attribute over the method and accordingly grants/deny access.</p>
  
  <p>How can I do that?</p>
  
  <p>Thanks</p>