title: ASP.net MVC 4 Users and Roles administration ("Membership.Provider" property must be an instance of "ExtendedMembershipProvider".)
body: <p>I've tried for 2 days to get something working but so far it's been pointless. What I need is to manage users and their roles, nothing else.</p>
  
  <p>What I've tried is to understand how to do it in MVC but I can't seem to find a detailed tutorial on how to do it, either on the internet or in any MVC 4 book.</p>
  
  <p>I started by enabling the aspnet database with the aspnet_regsql utility, this create these tables:</p>
  
  <p><img src="https://i.stack.imgur.com/g4ZdK.png" alt="Tables added by aspnet_regsql"></p>
  
  <p>That's all I found on the tutorial, it does not show how to interact with these tables 
  (which I assume is with the default membership provider), so far I've found there are 3 main options for doing this:</p>
  
  <ul>
  <li>Default membership provider (from whom I know nothing)</li>
  <li>Universal Providers</li>
  <li>SimpleMembership</li>
  </ul>
  
  <p>I found this tutorial: </p>
  
  <p><a href="http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-7" rel="nofollow noreferrer">http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-7</a></p>
  
  <p>Here they ask to create a new MVC 4 application project with internet application template and copy all the files relating the account control.</p>
  
  <p>I did that for my project but as soon as I try to log in I get :</p>
  
  <p>To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider".</p>
  
  <p>which according to this forum:
  <a href="http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/d352bb1b-577c-42b7-8872-5ed59cd65f32/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/d352bb1b-577c-42b7-8872-5ed59cd65f32/</a></p>
  
  <p>is because of how I defined the profile, membership and roleManager providers on my web.config file which is defined as follows:</p>
  
  <pre><code>&lt;profile&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="DatabaseConnection" applicationName="/" /&gt;
    &lt;/providers&gt;
  &lt;/profile&gt;
  &lt;membership&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="DatabaseConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  &lt;roleManager enabled="true"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add connectionStringName="DatabaseConnection" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /&gt;
      &lt;add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /&gt;
    &lt;/providers&gt;
  &lt;/roleManager&gt;
  </code></pre>
  
  <p>All I need is to be able to add new users, assign roles to them and show different content according to the role accessing the view.</p>
  
  <p><strong>Question #1</strong>
  What is the membership provider being used when I create an MVC 4 application with an internet application template?</p>
  
  <p><strong>Question #2</strong></p>
  
  <p>What am I doing wrong with the web.config file? How can I define the providers correctly?</p>
  
  <p><strong>Question #3</strong></p>
  
  <p>Which option suits me better? If you know a nice tutorial for it could you please link me to it?</p>
  
  <p><strong>Any help will be really appreciated! thanks in advance!</strong></p>