ASP.NET 4 自定义成员资格提供程序表
现在这可能很简单,但我似乎无法弄清楚。
我已经设置了自定义会员资格提供程序,并为其提供了正确的连接内容。 我所知道的是它连接到正确的数据库,但我确信它没有查看正确的表。
我如何设置它以使用特定的表?因为表中已经有用户。
表名称为:members_info
。
列名称为:member___id(key)、member_name、member__pwd、member_perm
member___id => Being the Key and the account name to login with
member_name => Being the users Name or Nickname
member__pwd => 10 chars long (for now)
member_perm => holds 1 of the following values: 0) User 1)Admin 2)Banned
现在我知道后者将由角色提供者设置,并且我确信一旦我知道如何执行会员资格在某种程度上是相似的。
所以我的问题是,如何将自定义会员资格提供程序指向表:members_info
并使用 member___id
作为用户名,members__pwd
作为密码(并可能让member_name 在他们登录时说:欢迎{member_name}!
预先感谢您提供的任何帮助!
===
添加了信息。 Members__uid 是关键值,随着每个新条目的增加而增加。
===
既然你不能告诉它使用特定的表,
我该如何设置它,使其与 Visual Studio 中提供的工具一起使用? (网站 > ASP.net 配置)。
现在安全选项卡上显示 0 个用户。我也希望能够通过这里管理用户。
Now this might just be straightforward, but I can't seem to figure it out..
I have set up the Custom Membership provider, and gave it the proper connection stuff.
What I know is that it connects to the correct database, but I know for sure that it doesn't look at the correct table.
How would I set it up to use a specific table? As the table already has users in them.
The table name is: members_info
.
the column names are: member___id(key), member_name, member__pwd, member_perm
member___id => Being the Key and the account name to login with
member_name => Being the users Name or Nickname
member__pwd => 10 chars long (for now)
member_perm => holds 1 of the following values: 0) User 1)Admin 2)Banned
now I know that the later one is to be setup by the Role Provider, and I'm sure once I know how to do the membership one that one is similar in some way.
So my question is, how do I point the Custom Membership Provider to the table: members_info
and to use member___id
for username, members__pwd
for password (and possibly get member_name out to say: Welcome {member_name}! when they login).
Thanks in advance for any help you can provide!
===
Added info.
Members__uid is the key value as it increases on each new entry.
===
Since you can't tell it to use a specific table
How can I set it up so, that it works with the tool provided in visual studio? (Website > ASP.net Configuration).
As it now says 0 users, on the security tab. I want to be able to manage the users through here too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不会告诉您的会员提供商“使用此表”。相反,您只需实现方法,它将在表中查找数据。您必须手动实现方法(来自 MembershipProvider 接口),这些方法将有权访问数据库并根据表中的数据执行您的逻辑(例如验证用户凭据)。
您可以在 这个问题。
You don't tell "Use this table" to your membership provider. Instead you just implement methods, that will look for data in your table. You have to manually implement methods (from MembershipProvider interface) that will have access to db and will execute your logic (validation o users credentials for example) based on data from your table.
You an get more specific info in this question.