0
votes

I am trying to connect to a SQL Server database that already has all of the correct tables (among others) for using login credentials.

I have this code in my web.config file:

<connectionstrings>
   <add name="abcdCS" 
        providerName="System.Data.SqlClient" 
        connectionstring="Data Source=SERVERNAME;Initial Catalog=SCRUMAPIUI;Integrated Security=False;User ID=MYUSERNAME;Password=MYPASSWORD;MultipleActiveResultSets=True" />
</connectionstrings>

and when I open Website Administration Tool > Security, I get the following error:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unrecognized configuration section add. (C:\Documents and Settings\tunnelld\My Documents\Visual Studio 2010\WebSites\ZSRBlank\web.config line 7)

I have been trying to fix this for 5 hours. When I go to Website Administration Tool > Provider and test it always says:

Successfully established a connection to the database.

Please help!

I have followed this tutorial exactly and get the same error: http://www.codeproject.com/Articles/89029/Using-SQL-Membership-with-ASP-NET-application

1
Have you looked to see what's at line 7 of your web.config file? That's where the error is pointing.Paul Keister
Line seven is shown above, its the line that starts with <addDavid Tunnell
Have you verified the username and password work by logging into the database using SQL Management Studio with those credentials?Garrison Neely
yes, I can login via database explorer and SQL managment studio fine.David Tunnell
Can you run a trace on the server while you attempt to connect? It might be something quick to try, and if you can, then vary the parameters like multi result sets, password, userid etc and see if any errors you get back help. Otherwise you might try hitting the logs on your pc/the server and even the network traffic. When you use mgmt studio, is that on your pc or the server? You need to isolate which part of the connection attempt is failing - just be happy you're not using windows auth/kerberos!.meataxe

1 Answers

1
votes

I think there's a slight typo here. The property connectionstring in the add tag should actually be connectionString. Try this

<connectionstrings>
<add name="abcdCS" providerName="System.Data.SqlClient" connectionString="Data Source=SERVERNAME;Initial Catalog=SCRUMAPIUI;Integrated Security=False;User ID=MYUSERNAME;Password=MYPASSWORD;MultipleActiveResultSets=True" />
</connectionstrings>

If the server and database name are correct and the user credentials are correct it should work now. Also make sure that all your membership and role providers in your web config are now using your new connection string. Should look something like this.

 <membership>
  <providers>
    <clear />
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="abcdCS" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
  </providers>
</membership>

Also check that the role manager has been enabled.

<roleManager enabled="true">

Hope this helps. Good Luck...