title: How to get RoleProvider to Work?
body: <p>This is a MVC 3 project.  Just for testing, I have</p>
  
  <pre><code>public class MyRoleProvider : RoleProvider
  {
      public override string[] GetRolesForUser(string username)
      {
          return new string[] { "0", "1", "2", "4" };
      }
  
      public override bool IsUserInRole(string username, string roleName)
      {
          bool result = true;
          return result;
      }
  </code></pre>
  
  <p>I register it in web.config. And then, if I configure the standard SqlMemberShipProvider, something like the following will cause my GetRolesForUser to fire.</p>
  
  <pre><code>[Authorize(Roles="4")]
  public class AdminController : Controller
  {  //...
  </code></pre>
  
  <p>However, I don't want to use the standard SqlMemberShipProvider.  I defined by own AuthorizeAttribute as follows, just to test:</p>
  
  <pre><code>public class MyAuthorize : AuthorizeAttribute
  {
      protected override bool AuthorizeCore(HttpContextBase httpContext)
      {
          bool result = true;
          return result;
          return base.AuthorizeCore(httpContext);
      }
  
      protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
      {
          base.HandleUnauthorizedRequest(filterContext);
      }
  
      public override void OnAuthorization(AuthorizationContext filterContext)
      {
          base.OnAuthorization(filterContext);
      }
  }
  </code></pre>
  
  <p>Now, the following will not cause MyRoleProvider.GetRolesForUser to fire anymore.</p>
  
  <pre><code>[MyAuthorize(Roles="4")]
  public class AdminController : Controller
  {  //...
  </code></pre>
  
  <p>The above will trigger MyAuthorize.AuthorizeCore and MyAuthorize.OnAuthorization but not the methods in MyRoleProvider.  What is the relationship between the MemberShipProvider, the RoleProvider and the AuthorizedAttribute?  When are these relationships defined or configured?</p>
  
  <p>Thanks.</p>