title: MySQLRoleProvider
body: <p>I am using MySQL Connector/.NET and a custom MySQL membership provider.</p>
  
  <p>Here is a part of the web.config:</p>
  
  <pre><code>&lt;roleManager enabled="true" defaultProvider="MySQLRoleProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add applicationName="name" description=""
        connectionStringName="MySQLMP" writeExceptionsToEventLog="False"
        autogenerateschema="True" name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /&gt;
    &lt;/providers&gt;
  &lt;/roleManager&gt;
  &lt;membership defaultProvider="MySQLMembershipProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;remove name="MySQLMembershipProvider" /&gt;
      &lt;add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="name" description="MySQL default application" connectionStringName="MySQLMP" writeExceptionsToEventLog="False" autogenerateschema="True" enablePasswordRetrieval="False" enablePasswordReset="True" requiresQuestionAndAnswer="True" requiresUniqueEmail="True" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  &lt;profile defaultProvider="MySQLProfileProvider"&gt;
    &lt;properties&gt;
      &lt;add name="AccountNumber" type="string" provider="" /&gt;
      &lt;remove name="MySQLProfileProvider" /&gt;
      &lt;add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/&gt;
    &lt;/properties&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="MySQLProfileProvider" connectionStringName="MySQLMP" applicationName="name" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" /&gt;
    &lt;/providers&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>In addition to that I am using ASP.NET authentication form.
  What I am trying to do is: after a user logs in, I want to check if he/she is an admin and redirect to a certain page. Easy, right?</p>
  
  <p>I believe, I am supposed to use the following:</p>
  
  <pre><code>if(Role.IsUserInRole(lgnCustomer.UserName, "Administrator"))
          lgnCustomer.DestinationPageUrl = "~/admin";
  </code></pre>
  
  <p>However, for some reason I cannot use "Role". It seems like its missing reference to the MySQLRoleProvider. </p>
  
  <p>Everything else (user registration, log in, role differentiation) works...</p>
  
  <p>Thank you in advance!</p>