我正在将一个ASP.NET网站迁移到Sitecore 7。我有一个登录页面,供外部用户登录我的网站。我尝试访问外部aspnetdb来进行身份验证。我已经按照这篇文章中的步骤进行:
Sitecore authenticate users against external membership database
当我尝试调用GetUser方法时,我得到了一个null值。此外,当我转到我的用户管理器时,我没有看到位于aspnetdb中的任何用户。
我的配置如下所述:
我在ConnectionsStrings.config中添加了一个连接字符串:
<add name="test" connectionString="user id=***;password=***;Data Source=localhost;Database=aspnetdb"/>
我在web.config文件中添加了成员资格和角色提供程序的定义:
<membership defaultProvider="sitecore" hashAlgorithmType="SHA1">
<providers>
<clear/>
<add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="switcher" providerWildcard="%" raiseEvents="true"/>
<add name="sql" type="System.Web.Security.SqlMembershipProvider" connectionStringName="core" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="256"/>
<add name="switcher" type="Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/membership"/>
<add name="testProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="test" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="256"/>
</providers>
</membership>
<roleManager defaultProvider="sitecore" enabled="true">
<providers>
<clear/>
<add name="sitecore" type="Sitecore.Security.SitecoreRoleProvider, Sitecore.Kernel" realProviderName="switcher" raiseEvents="true"/>
<add name="sql" type="System.Web.Security.SqlRoleProvider" connectionStringName="core" applicationName="sitecore"/>
<add name="switcher" type="Sitecore.Security.SwitchingRoleProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/roleManager"/>
<add name="testProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="test" applicationName="sitecore"/>
</providers>
</roleManager>
然后我添加了我的域名切换映射:
<switchingProviders>
<membership>
<provider providerName="sql" storeFullNames="true" wildcard="%" domains="*"/>
<provider providerName="testProvider" storeFullNames="false" wildcard="%" domains="extranet"/>
</membership>
<roleManager>
<provider providerName="sql" storeFullNames="true" wildcard="%" domains="*"/>
<provider providerName="testProvider" storeFullNames="false" wildcard="%" domains="extranet"/>
</roleManager>
<profile>
<provider providerName="sql" storeFullNames="true" wildcard="%" domains="*"/>
</profile>
</switchingProviders>
任何帮助都将不胜感激。
谢谢。