摘要: 我想使用asp.net成员资格,角色和配置文件,但我无法得到我的code使用由aspnet_regsql.exe的产生的表。
我的尝试:
在aspnet_regsql.exe的冉在我的数据库。这个工作并创建了所有的表。 名为 Membership.CreateUser(tester7,tester7,tester7@hi.com);
这则创建以下表和存储的用户dbo.Memberships,而不是dbo.aspnet_Memberships。
dbo.Applications dbo.Memberships dbo.Profiles dbo.Roles dbo.Users dbo.UsersInRoles它完全忽视了aspnet_regsql.exe的创建的表。
这是怎么回事,我能做些什么来定位到aspnet_ *表?
修改,包括Web.config文件会员注册
<会员defaultProvider =ProjectMembershipProvider>
<供应商>
<添加名称=ProjectMembershipProviderTYPE =System.Web.Providers.DefaultMembershipProvider,......的connectionStringName =ProjectSqlenablePasswordRetrieval =假enablePasswordReset设置=真正的requiresQuestionAndAnswer =假requiresUniqueEmail =假maxInvalidPasswordAttempts = 5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10的applicationName =项目/>
< /供应商>
< /会员>
解决方案
您必须在您的配置文件中添加登记部
System.Web.Providers.DefaultMembershipProvider都在SQL精简和海岸应用
您有部分成员,另一个角色管理器
<隶属>
<供应商>
<添加
NAME =AspNetSqlMembershipProvider
TYPE =System.Web.Security.SqlMembershipProvider,...
的connectionStringName =LocalSqlServer这个
enablePasswordRetrieval =假
enablePasswordReset设置=真
requiresQuestionAndAnswer =真
的applicationName =/
requiresUniqueEmail =假
了passwordFormat =散列
maxInvalidPasswordAttempts =5
minRequiredPasswordLength =7
minRequiredNonalphanumericCharacters =1
passwordAttemptWindow =10
passwordStrengthRegularEx pression =
/>
< /供应商>
< /会员>
Summary: I am trying to use asp.net membership, roles, and profiles, but am having trouble getting my code to use the tables generated by aspnet_regsql.exe.
What I tried:
Ran aspnet_regsql.exe on my database. This worked and all the tables were created. CalledMembership.CreateUser("tester7","tester7","tester7@hi.com");
This then created the following tables and stored the user in dbo.Memberships instead of dbo.aspnet_Memberships.
dbo.Applications dbo.Memberships dbo.Profiles dbo.Roles dbo.Users dbo.UsersInRolesIt completely ignored the tables created by aspnet_regsql.exe.
Why is this happening and what can I do to target to aspnet_* tables?
Edit to include Web.config Membership registration
<membership defaultProvider="ProjectMembershipProvider">
<providers>
<add name="ProjectMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider,..." connectionStringName="ProjectSql" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="Project" />
</providers>
</membership>
解决方案
You must add registering section in your config file
System.Web.Providers.DefaultMembershipProvider are on Sql Compact and Azur application
You have section for membership and another for role manager
<membership>
<providers>
<add
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, ..."
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
/>
</providers>
</membership>