title: UserRoles Not Working In Asp.Net
body: <p>I am currently trying to get the <code>UserRoles</code> to work in ASP.NET. I am facing some issues. For some reason it doesn't seem to pick up the roles from the DB.</p>
  
  <p>I am changing the table name to meet my requirement by using the following code in <code>IdentityModels.cs</code> </p>
  
  <pre><code>protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
      {
          base.OnModelCreating(modelBuilder);
  
          modelBuilder.Entity&lt;IdentityUserRole&gt;().ToTable("MyRroles");
      }
  </code></pre>
  
  <p>At First it couldn't find the schema and after doing some research I followed <strong><a href="http://msdn.microsoft.com/en-us/library/ms229862.ASPX" rel="nofollow">this</a></strong> article and that particular error disappeared. However following the article it added the following tables in my DB</p>
  
  <pre><code>aspnet_Applications
  aspnet_Roles
  aspnet_SchemaVersions
  aspnet_Users
  aspnet_UsersInRoles
  </code></pre>
  
  <p>Which I don't need. I'm doing a basic <code>if</code> statement to check whether the roles are working of not. And it doesn't seem to pick up the roles.</p>
  
  <pre><code>if(Roles.RoleExists("RoleName"))
          {
              Button1.Visible = false;
      }
  </code></pre>
  
  <p>In my <code>web.config</code> file I have the following code </p>
  
  <pre><code>&lt;roleManager defaultProvider="MyConn" enabled="true"&gt;
          &lt;providers&gt;
              &lt;add
                name="MyConn"
                type="System.Web.Security.SqlRoleProvider"
                connectionStringName="MyConn"
                applicationName="MyApp"/&gt;
          &lt;/providers&gt;
      &lt;/roleManager&gt;
  </code></pre>
  
  <p>Can anyone tell me where I am going wrong please. Thank you for all your help and support</p>