title: ASP .NET MVC Forms authorization with Active Directory groups
body: <p>I'm attempting to authenticate using users and groups in ASP.NET MVC against Active Directory.</p>
  
  <p>I have put the following attribute on all my classes (except the account class):</p>
  
  <pre><code>[Authorize (Roles="SubcontractDB Users")]
  </code></pre>
  
  <p>This group is found under OU=Area->OU=Groups->OU=Company->CN=SubcontractDB in active directory. I'm assuming I also need to setup a RoleManager in web.config which I've attempted to do as follows:</p>
  
  <pre><code>&lt;roleManager defaultProvider="ADRoleProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
          &lt;add name="ADMembershipProvider" 
               type="System.Web.Security.ActiveDirectoryMembershipProvider" 
               connectionStringName="ADConnectionString" 
               attributeMapUsername="sAMAccountName" /&gt;
    &lt;/providers&gt;
  &lt;/roleManager&gt;
  </code></pre>
  
  <p>My connection string is:</p>
  
  <pre><code>    &lt;add name="ADConnectionString" 
           connectionString="LDAP://blah.com:389/DC=blah,DC=wateva,DC=com"/&gt;
  </code></pre>
  
  <p>Obviously I'm doing it wrong as this doesn't work.  All I want to do is allow access to users that are a member of a certain group in AD.</p>