开发者

connectionstring in asp.net 2.0

开发者 https://www.devze.com 2023-02-03 07:04 出处:网络
Hello I have a problem with my connection string below: <configuration> <connectionStrings>

Hello I have a problem with my connection string below:

<configuration>
  <connectionStrings>
    <add name="ApplicationServices" 
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
    <add name="ConnectionString" 
         connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=开发者_开发问答|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <customErrors defaultRedirect="~/error.aspx" mode="RemoteOnly"/>

    <authentication mode="Forms">
      <forms loginUrl="~/login.aspx" />
    </authentication>

    <authorization>
      <allow users="*" />
    </authorization>

    <roleManager enabled="true" />
    <compilation debug="true" />

    <membership>
      <providers>
        <remove name="AspNetSqlMembershipProvider" />
        <add name="AspNetSqlMembershipProvider"
             type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
             connectionStringName="LocalSqlServer"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="true"
             applicationName="/"
             requiresUniqueEmail="false"
             passwordFormat="Hashed"
             maxInvalidPasswordAttempts="5"
             minRequiredPasswordLength="1"
             minRequiredNonalphanumericCharacters="0"
             passwordAttemptWindow="10"
             passwordStrengthRegularExpression=""/>
      </providers>
    </membership>
  </system.web>

  <location path="~/securepage.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

</configuration>

Can anyone let me know were the proble is coming front? I don't know if the problem is coming from add name="ApplicationServices". I will appreciate ur help


You're referencing connectionStringName="LocalSqlServer" which doesn't exist. The two connection strings you have registered are ApplicationServices and ConnectionString.

Rename your second connection string entry to:

<add name="LocalSqlServer" ...
0

精彩评论

暂无评论...
验证码 换一张
取 消