user1133605
user1133605

Reputation: 11

error on website administration tool with security tab

hello i found an error when i am working with the asp.net web administration tool security tab....and i am using the sqlProvider as the default provider.

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: An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax. Parameter name: connectionString

Upvotes: 1

Views: 3138

Answers (1)

user596075
user596075

Reputation:

Do you have a <connectionStrings /> element in your web.config file? You need this to be able to connect to your MembershipProvider and RoleProvider.

Here are the necessary elements you'll need to utilize the SqlMembershipProvider and the SqlRoleProvider.

Notice that there are the following sections:

  • <connectionStrings />
  • <membership /> (in the <system.web /> section)
  • <roleManager /> (in the <system.web /> section)

web.config

<configuration>
  <connectionStrings>
    <add name="YourConnectionString"
         providerName="System.Data.SqlClient"
         connectionString="data source=YOURSERVER;
          initial catalog=YOURDB;user id=YOURINSTANCELOGIN;password=YOURPASSWORD;"/>
  </connectionStrings>

  <system.web>
    <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider"
             connectionStringName="YourConnectionString"
             applicationName="YourApplicationName"/>
      </providers>
    </membership>

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

    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>
  </system.web>

</configuration>

Upvotes: 5

Related Questions