Search code examples
asp.net-mvc-4azureazure-sql-databaseazure-web-rolessimplemembership

ApplicationName is not stored in database using SimpleMembership provider


I have tried using SqlMembershipProvider and SimpleMembershipProvider with application name set in web.config file as shown below. I'm able to register new accounts and login but application name is not getting stored in database table aspnet_Applications.

<roleManager enabled="true" defaultProvider="SqlRoleProvider">
  <providers >
    <clear />
    <add name="SqlRoleProvider"
     type="System.Web.Security.SqlRoleProvider"
     connectionStringName="DefaultConnection"
     applicationName="BasicCloudProject" />
  </providers>
</roleManager>

<membership defaultProvider="SimpleMembershipProvider" >
  <providers>
    <clear />
    <add
      name="SimpleMembershipProvider"
      type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData"
      connectionStringName="DefaultConnection"
      applicationName="BasicCloudProject"
      />
  </providers>
</membership>

I have set up MVC4 web role in Azure project with MS SQL database having tables as per aspnet_regsql.exe.


Solution

  • The SimpleMembershipProvider does not use the traditional ASP.NET membership database, which you are referring to when you mention the table aspnet_Applications. It has a completely different database schema, which does not include the concept of Applications. If you want to use this to create a multi-tenant application take a look at this QA.