Connection String Incorrectly Formatted
<p>I'm running into some issues. Every time I launch into debug mode and hit the "Create User" button, I'm getting an exception being thrown that is due to the Connection String either being in the wrong syntax or just wrong.</p>

<p>Using Visual Studio 2010, project is .NET 3.5 with SQL 2008 Express.</p>

<p>This is just a personal project that I'm testing some other things with, I know this generally isn't the recommended format but for a personal small project, I don't see the point in doing it any other way. The things I'm testing actually work :) </p>

<pre><code>Data Source=.\SQLEXPRESS;AttachDbFilename=|Data Directory|ASPAppDatabase.mdf;Integrated Security=True;User Instance=True
</code></pre>

<p>That doesn't work.</p>

<pre><code>Data Source=.\SQLEXPRESS;AttachDbFilename="|Data Directory|ASPAppDatabase.mdf";Integrated Security=True;User Instance=True
</code></pre>

<p>Neither does that.</p>

<pre><code>Data Source=.\SQLEXPRESS;AttachDbFilename='|Data Directory|ASPAppDatabase.mdf';Integrated Security=True;User Instance=True
</code></pre>

<p>And again, neither does that :/</p>

<p>However, rather than using "|Data directory| if I use the full path to the local DB file it works just fine and no exception is thrown, and I can read and write as I need.</p>

<p>And just to cover all my bases, here is the button click event that creates the User.</p>

<pre><code> protected void btnAddUser_Click(object sender, EventArgs e)
        {
            Membership.CreateUser(txtUserName.Text, txtPassword.Text);
            btnLogin_Click(sender, e);
        }
</code></pre>

<p>So, what am I missing in regards to the |Data Directory|?</p>

<p>Here is an example of the above not working correctly..taken directly from web.config.</p>

<pre><code>&lt;add name="ASPAppDatabaseConnection" connectionString='Data Source=.\SQLEXPRESS;AttachDbFilename=|Data Directory|ASPAppDatabase.mdf;Integrated Security=True;User Instance=True'/&gt;
</code></pre>

<p>Edit: And this is the full path connection string:</p>

<pre><code>Data Source=.\SQLEXPRESS;AttachDbFilename="Full Path to DB\ASPAppDatabase.mdf";Integrated Security=True;User Instance=True
</code></pre>
