WebConfig里的配置成员资格角色管理

把连接改一下,先清掉Machine.config里的连接,再加一条,最好名字一样,不然在Asp.net配置那里会有点麻烦。  

<connectionStrings>
     
<clear/>
     
<add name="LocalSqlServer" connectionString="Data Source=.;Initial Catalog=SocanCRM;Persist Security Info=True;User ID=sa;Password="
       providerName
="System.Data.SqlClient" />
</connectionStrings>

然后配置以下三个节点

    <membership>
       
<providers>
         
<clear/>
         
<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="false" applicationName="SocanCRM" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
       
</providers>
     
</membership>
     
<profile>
       
<properties>
         
<add name="UserProfile" type="String" allowAnonymous="false" />
       
</properties>
       
<providers>
         
<clear/>
         
<add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="SocanCRM" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       
</providers>
     
</profile>
     
<roleManager enabled="true">
       
<providers>
         
<clear/>
         
<add connectionStringName="LocalSqlServer" applicationName="SocanCRM" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
       
</providers>
     
</roleManager>

profile节里必须有东西才行,不然Profile.UserName一直为空

posted on 2007-08-14 23:18  廖勇军  阅读(230)  评论(0编辑  收藏  举报

导航