ASP.NET Memberships Database

I used Visual Web developer 2008 to create a web site that uses the built-in ASP.NET Membership functionality to create users and roles.  Works perfect on my my computer, but when moved to the web site (my VPS), I get the following error:

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

My doubt is it is failing to connect to you DB or some ASPNET/ NetworkService User account permission.
I would suggest to make sure your connectionString is corret and pointing to the correct Database.
How did you upload your membership DB to your server?

share your web.config connectionstring / membership provider info.
rrhandle8Author Commented:
There is no web.config connectionstring
Where do I find: membership provider info.

The error has changed to this:
An attempt to attach an auto-named database for file C:\Inetpub\vhosts\\subdomains\mft\httpdocs\App_Data\mft_aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Notice I tried to rename the database, but that did not help.
The default membership settings are from your machine.config.
It uses connectionStringName = LocalSqlServer ...i.e. in your machine.config's connectionstrings can find this LocalSqlServer connectionString.
One more question...are you using SqlExpress DB or other Sql Sever?
Check this for more info:
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

rrhandle8Author Commented:
sami, from what I understand, my problem is that I am trying to use it on my VPS, and you cannot use SQL Express on a web site.  Is that correct?  If it is, that answers my question.
You can use SQL Express on your server as well and your website can use it.
I only doubt that there might be some DB connection/permission issue.
rrhandle8Author Commented:
If I find the  machine.config's connectionstrings, what do I use in place of LocalSqlServer?
In your web.config add the following. It will override the machine.config LocalSqlServer connectionString settings.
        <remove name=LocalSqlServer/>
        <add name="LocalSqlServer" connectionString="ConnectionStringToYourASPNETDB on your Server" providerName="System.Data.SqlClient"/>

rrhandle8Author Commented:
I did as you said.  It got me past the current error, but now I get this:

Format of the initialization string does not conform to specification starting at index 0.

        <remove name="LocalSqlServer"/>
        <add name="LocalSqlServer" connectionString="C:\Inetpub\vhosts\\subdomains\mfft\httpdocs\App_Data\ASPNETDB.mdf" providerName="System.Data.SqlClient"/>
If your DB is in app_Data Folder then using local sql Express instance  the default in machine.config should work.....still try replacing your connectionString like below...

<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>

Also if you ge the same error again...check the event log and see if there is any other permission related error message...      
rrhandle8Author Commented:
Now I get this error, which I have had before.
An attempt to attach an auto-named database for file C:\Inetpub\vhosts\\subdomains\mft\httpdocs\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
rrhandle8Author Commented:
This is from the event viewer.

Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 7/10/2009 11:08:00 PM
Event time (UTC): 7/11/2009 3:08:00 AM
Event ID: 45151ec0fa74466f96c133f7693aabaf
Event sequence: 2
Event occurrence: 1
Event detail code: 0
Application information:
    Application domain: /LM/W3SVC/8348/Root-2-128917552801115006
    Trust level: Full
    Application Virtual Path: /
    Application Path: C:\Inetpub\vhosts\\subdomains\mft\httpdocs\
    Machine name: CT3237
Process information:
    Process ID: 16624
    Process name: w3wp.exe
Exception information:
    Exception type: SqlException
    Exception message: An attempt to attach an auto-named database for file APP_DATA/aspnetdb_mft.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Request information:
    Request URL: unhandled exception has occurred.fmembersAn unhandled exception has occurred.fDefault.aspx
    Request path: /login.aspx
    User host address:
    Is authenticated: False
    Authentication Type:  
    Thread account name: NT AUTHORITY\NETWORK SERVICE
Thread information:
    Thread ID: 10
    Thread account name: NT AUTHORITY\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate)
   at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)
   at System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate)
   at System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat)
   at System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved)
   at System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password)
   at System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e)
   at System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)
   at System.Web.UI.WebControls.Login.AttemptLogin()
   at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details:

For more information, see Help and Support Center at
Sorry rrhandle8 ...i am not sure whats happening as I have always been using sql Server 2005 but one thing I overlooked in your previous connectionString is your connectionString was not in right format ..
when you got the error:
"Format of the initialization string does not conform to specification starting at index 0. "
It should be something like below:

<add name="LocalSqlServer" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Inetpub\vhosts\\subdomains\mfft\httpdocs\App_Data\ASPNETDB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

Try and see if it makes any difference....sorry about this confusion.
rrhandle8Author Commented:
Been to that link more than a few times over the last 5 days.
Client just cancelled the project, and awarded it to someone who put up a role based web site from him in under an hour using PHP and MySql.  He had a few colorful things to say about me and Microsoft.

I would still like to understand what is going on here.  This is the longest time I have spent trying to debug something, and it has gotten under my skin.  The web is full of people having problems with this feature in ASP.NET.  Is this one of those situations where Microsoft is not the solution?
did you tried the last connectionstring i gave...
As I said ..I haven't come across that error...nor I know how to replicate since I use Sql Server Standard not able to help you at the fullest ..but just used my knowledge about using membership provider to see if it works.
Sorry about that.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.