以下时提示错误原因:
Server Error in '/membership' Application.
--------------------------------------------------------------------------------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 'ConnectionString' was not found in the applications configuration or the connection string is empty.Source Error: 
Line 24:         <providers>
Line 25:           <clear/>
Line 26:           <add connectionStringName="ConnectionString" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 27:         </providers>
Line 28:       </roleManager>
 Source File: F:\VS2005资料\WebSites\membership\web.config    Line: 26 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 
以下为代码:<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
      <authentication mode="Forms">
        <forms loginUrl="login.aspx" name=".aspxlogin"/>
      </authentication>
      <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15" hashAlgorithmType="">
        <providers>
          <clear/>
          <add connectionStringName="ConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
      </membership>
      <roleManager enabled="true" cacheRolesInCookie="true">
        <providers>
          <clear/>
          <add connectionStringName="ConnectionString" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
      </roleManager>
        <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
        <compilation debug="false" />
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <!--<authentication mode="Windows" />
        --><!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    </system.web>
</configuration>

解决方案 »

  1.   

    你没有定义连接字符串。在membership里有一个connectionStringName   那个里边需要你一个连接字符串的名字。连接字符串可以定义在<connectionStrings/> 
    这个节点里!
    给你一个示例配置了!<connectionStrings>
    <add name="StrConn" connectionString="Data Source=srymbud\sql2005;Initial Catalog=MyBookShop;Persist Security Info=True;User ID=sa;Password=perishryu" providerName="System.Data.SqlClient"/>
    </connectionStrings><system.web> 
    <membership defaultProvider="SqlProvider">
    <providers>
    <clear/>
    <add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="StrConn" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" passwordFormat="Hashed" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>
    </providers>
    </membership>
    </system.web>