title: ASP.Net Membership Error CREATE DATABASE failed. Some file names listed could not be created. Check related errors
body: <p>I am trying to add AP.Net membership to my database. I have had success with this in the past so I have some idea of what I am doing. My project is a VB.Net website with Framework 4.5.2. I used asp_regsql.exe in framework 4 to add the schema to my db. I created the following web.config entries (per MSDN articles):</p>
  
  <pre><code>&lt;connectionStrings&gt;
  &lt;add name="AFKMSConnectionString" providerName="System.Data.SqlClient" connectionString="working as intended" /&gt;    
  </code></pre>
  
  <p></p>
  
  <pre><code>  &lt;system.web&gt;
  &lt;authentication mode="Forms" &gt;
    &lt;forms loginUrl="Account/Login.aspx"
      name=".ASPXFORMSAUTH" /&gt;
  &lt;/authentication&gt;
  &lt;!--&lt;authorization&gt;
    &lt;deny users="?" /&gt;
  &lt;/authorization&gt;--&gt;
  &lt;compilation debug="true" targetFramework="4.5.2"/&gt;
  &lt;httpRuntime targetFramework="4.5.2"/&gt;
  &lt;pages&gt;
    &lt;namespaces&gt;
      &lt;add namespace="System.Web.Optimization"/&gt;
      &lt;add namespace="Microsoft.AspNet.Identity"/&gt;
    &lt;/namespaces&gt;
    &lt;controls&gt;
      &lt;add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/&gt;
    &lt;/controls&gt;
  &lt;/pages&gt;
  &lt;membership defaultProvider="SqlMembershipProvider" userIsOnlineTimeWindow="15"&gt;
    &lt;providers&gt;
      &lt;clear/&gt;
      &lt;add
      name="SqlMembershipProvider"
      type="System.Web.Security.SqlMembershipProvider"
      connectionStringName="AFKMSConnectionString"
      applicationName="AFKMS"
      enablePasswordRetrieval="false"
      enablePasswordReset="true"
      requiresQuestionAndAnswer="false"
      requiresUniqueEmail="true"
      passwordFormat="Hashed" /&gt;
    &lt;/providers&gt;
  &lt;/membership&gt;
  &lt;profile enabled ="true" defaultProvider="SqlProvider"&gt;
    &lt;providers&gt;
      &lt;clear /&gt;
      &lt;add name="SqlProvider"
        type="System.Web.Profile.SqlProfileProvider"
        connectionStringName="AFKMSConnectionString"
        applicationName="AFKMS"
        description="SqlProfileProvider for SampleApplication" /&gt;
    &lt;/providers&gt;
  &lt;/profile&gt;
  &lt;roleManager enabled ="true"
             defaultProvider ="SqlRoleProvider" &gt;
    &lt;providers&gt;
      &lt;clear/&gt;
      &lt;add name ="SqlRoleProvider"
           type="System.Web.Security.SqlRoleProvider"
           connectionStringName="AFKMSConnectionString"
           applicationName="AFKMS"/&gt;
  
    &lt;/providers&gt;
  &lt;/roleManager&gt;
  </code></pre>
  
  <p>My connection string works for my current functions but when I try to register a user I get the following error: </p>
  
  <blockquote>
    <p>Directory lookup for the file "C:\Users\Dan\Source\Repos\AFKMS\AFKMS\App_Data\aspnet-AFKMS-140073d4-6858-4f19-9555-0edfbaadd43a.mdf" failed with the operating system error 2(The system cannot find the file specified.).
    CREATE DATABASE failed. Some file names listed could not be created. Check related errors.</p>
  </blockquote>
  
  <p>This comes from Accounts/Register, </p>
  
  <p>Dim result = manager.Create(user, Password.Text)</p>
  
  <p>Why is it trying to create a database? What does it look like I am missing?</p>