SQlMembershipProvider是否可以与umbraco一起使用 [英] Can the SQlMembershipProvider be used with umbraco
问题描述
有人有这样的例子吗?据我所读,umbraco有点臭,但我找不到任何例子
Does anybody have an examples of this, from what I've read umbraco kicks up a bit of a stink but I can't find any examples
推荐答案
是的,您绝对可以将SqlMembershipProvider与Umbraco一起使用.首先,您必须将连接字符串添加到配置文件中.
Yes, you absolutely can use the SqlMembershipProvider with Umbraco. First, you must add your connection string to the config file.
<add name="umbracoDbDSN" connectionString="Server=myhost.myexampledomain.com;Database=mydatabasename;User Id=myuserid; Password=myhardtobreakpassword;" providerName="System.Data.SqlClient" />
确保用于访问数据库的用户名和密码实际上可以正确访问Umbraco.
Make sure that the username and password to access the database will actually give proper access to Umbraco.
第二,必须确保将SqlClient数据提供程序添加到system.data的DbProviderFactories部分:
Second, you must ensure that the SqlClient data provider is added to DbProviderFactories section of system.data:
<add name="SqlClient Data Provider"
invariant="System.Data.SqlClient"
description=".Net Framework Data Provider for SqlServer"
type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
第三,必须将SqlServerMembershipProvider添加到providers部分:
Third, you must add the SqlServerMembershipProvider to the providers section:
<add name="SqlServerMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="umbracoDbDSN"
requiresQuestionAndAnswer="false"
applicationName="MyUniqueUmbracoApplication"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
请确保您从提供商那里引用的连接字符串与您先前定义的连接字符串匹配,并为应用程序指定适当的名称.
Make sure that the connectionstring you reference from your provider matches the connectionstring you defined earlier, and give the application an appropriate name.
第四,将SqlServerRoleProvider添加到roleManager的providers部分:
Fourth, add the SqlServerRoleProvider to the providers section of roleManager:
<add name="SqlServerRoleProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="umbracoDbDSN"
applicationName="MyUniqueUmbracoApplication"
/>
第五,将其添加到profie的providers部分:
Fifth, add it in the providers section of profie:
<add name="SqlProfile" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="umbracoDbDSN" applicationName="MyUniqueUmbracoApplication" />
第六,在数据库上运行aspnet_regsql.exe,以设置数据库以使用SqlMembershipProvider(
Sixth, run aspnet_regsql.exe on your database to setup the database to use the SqlMembershipProvider (Configuring the database with aspnet_regsql.exe).
第七,推出新的配置文件后,重新启动IIS.确保将IIS设置为使用新的提供程序.
Seventh, restart IIS after rolling out the new config file. Ensure that IIS is setup to use the new provider.
这里是配置数据库的另一资源:配置ASP.NET SqlMembershipProvider .
Here's another resource for configuring the database: Configuring ASP.NET SqlMembershipProvider.
To configure database permissions, here's the instructions: Configuring Umbraco database security. The important part is to add the user for the data provider to:
- db_datareader
- db_datawriter
- db_ddladmin
- db_securityadmin
- 公开
如果您的配置文件看起来有些不同,则可能是您使用了不同版本的Umbraco.我在此示例中使用的是7.0.3.
If your config file looks a bit different, you are likely using a different version of Umbraco. I am using 7.0.3 for this example.
这篇关于SQlMembershipProvider是否可以与umbraco一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!