0

After Configuring my asp.net connectionString in web config file my website run but when i tried to Login into my admin area I get an error message

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The connection name 'MyconnectionStringName' was not found in the applications configuration or the connection string is empty.

Source Error:

<providers>
Line 16:        <remove name="AspNetSqlMembershipProvider"/>
Line 17:        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="MyConnectionStringName" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
Line 18:      </providers>
Line 19:    </membership>

but it worked perfectly on Local Server.

My web.config file

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>

    <connectionStrings>
  <add name="AsconConnectionString" connectionString="LoginDetails"
   providerName="System.Data.SqlClient" />
 </connectionStrings>
 <system.web>
<customErrors mode="Off"/>
   <membership>
     <providers>
       <remove name="AspNetSqlMembershipProvider"/>
       <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ConnectionDetails" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
     </providers>
   </membership>
        <roleManager enabled="true" />
  <authentication mode="Forms" />
  <compilation debug="false" targetFramework="4.0"/>
    </system.web>
</configuration>
Community
  • 1
  • 1
user3055606
  • 65
  • 1
  • 12

1 Answers1

0

I had same issue. It will work on local but to run on server you need to update schema version to your db. you will not use aspnetdb.mdf directly

you can find script for that and update with your DB. hope this can solve your issue

download this script from this link https://drive.google.com/file/d/0B2D0SiDP8hTFN2tDX04zYVp6OXc/edit?usp=sharing

now you need to add this to your config file

<system.web>
<!-- membership provider -->
<roleManager enabled="true">
  <providers>
    <clear/>
    <add name="AspNetSqlRoleProvider"
        connectionStringName="myportalconstr"
        applicationName="/"
        type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  </providers>
</roleManager>
<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
        connectionStringName="myportalconstr"
        applicationName="/"
    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0,           Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
</membership>

 <trust level="Full" /> 
  <customErrors mode="Off" defaultRedirect="home"/>
  <anonymousIdentification enabled="true"/>

  <profile enabled="true">
  <providers>
    <clear/>
    <add applicationName="/myportal"  connectionStringName="myportalconstr"     name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider"/>
  </providers>

</profile>
</system.web>
Hardik Mer
  • 824
  • 4
  • 14
  • 26
  • After I export my database to online server i noticed that dbo. is added as prefix to my each of my tableName is this what you mean? Pls how do I update the Schema pls guide me. even with the prefix added my website still get data from database and work perfectly but only does not Login. How do i do it pls – user3055606 Jan 29 '14 at 14:13
  • check my updated answer, i have attached script and code that you need to add in config file. mark as answer if it helped. thanks :) – Hardik Mer Jan 29 '14 at 14:14
  • dbo is the default schema in SQL Server. at present there is not need to modify this – Hardik Mer Jan 29 '14 at 14:17
  • what can I do to make my Login Work? do I need to configure the web config file to allow role or what. pls check my web config file above – user3055606 Jan 29 '14 at 14:29
  • Where would i run the aspnetdb.sql script? and what does it function as? – user3055606 Jan 29 '14 at 14:57
  • run it with your current DB for your application. it will update db schema. as you can't use aspnetdb directly on your server. so you are customizing it with your db – Hardik Mer Jan 29 '14 at 15:34
  • this is how my database table is name on production server ex: dbo.aspnet_Roles. The script i use on my production server is that I generate the aspnetdb script from my VS2010 and run it on sql2005 to create backup and i then restore it to production server. pls im i doing anything wrongly? – user3055606 Jan 29 '14 at 15:44
  • run this on your db that you are using for your application. for ex I am using database myportal.mdf to I have to run this scrip on this database. so tables in script file will be added to your myportal.mdf – Hardik Mer Jan 30 '14 at 05:53