asp.net 任意用户信息
如果我使用 asp.net 的内置成员资格提供程序,那么如何在使用 CreateUserWizard 控件时存储任意用户信息?
假设我的应用程序中有三种类型的用户:学生、教师和职员。 我想为每个用户存储一个标志,以在通过 CreateUserWizard 创建用户时区分他们的类型 - 控件。
怎么做?
If I am using asp.net's built-in membership provider, then how can I store arbitrary user-info while using CreateUserWizard control?
Suppose I have three types of users in my application: Student, Teacher and Staff. I want to store a flag for every user to distinguish their types while creating a user through CreateUserWizard - control.
How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可能应该看看这个关于 Asp.Net 成员资格、角色和配置文件的长系列。 它应该有足够多的信息来帮助您完成您想要做的事情。
第 6 部分特别涵盖配置文件部分。
https://web. archive.org/web/20210513220018/http://aspnet.4guysfromrolla.com/articles/120705-1.aspx
You should probably have a look at this long series on the Asp.Net Membership, Roles, and Profiles. It should have more then enough information to get you what you are trying to do.
Part 6 specifically covers the Profile portion.
https://web.archive.org/web/20210513220018/http://aspnet.4guysfromrolla.com/articles/120705-1.aspx
简短的回答:使用配置文件。
Short answer: use Profile.
使用用户配置文件来存储用户信息。 在这种情况下,您似乎正在根据登录的人员创建角色。 如果这是真的,也许使用/设置角色是更好的方法。
Use a user profile to store user information. It looks as though you are creating a role based on the person logging in in this case. If this is true perhaps using / setting a role is the better approach on this.
我同意@klabranche,使用角色是“用户类型”(学生、教师和员工)的完美解决方案。
我还没有使用 CreateUserWizard 完成此操作,但它应该非常简单: 如何使用 CreateUserWizard 将用户添加到角色。
I agree with @klabranche, using roles is the perfect solution for "types of users" (Student, Teacher and Staff).
I haven't done it with CreateUserWizard, but it should be pretty straightforward: How to Add Users to Roles Using the CreateUserWizard.