ASP成员资格表->向用户添加新属性? [英] ASP Membership tables -> add new property to user?

查看:66
本文介绍了ASP成员资格表->向用户添加新属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我正在构建的新MVC4项目中开始使用ASP.NET的成员资格类和表.

I would like to start using ASP.NET's membership classes and tables with a new MVC4 project I am building.

例如,我想跟踪用户的生日.创建帐户时,如何添加生日?我通过个人档案跟踪吗?我对为用户添加新的列"数据的正确方法有些困惑?

Let's say for example I want to keep track of user's birthdays. When creating the account, how do I add in the birthday? Is this something I keep track of with Profiles? I'm a bit confused on the correct way to add new 'columns' of data for users?

推荐答案

要专门回答您的问题,请按照以下Microsoft建议创建额外的表来存储其他用户信息:

To specifically answer your question, here's how Microsoft advises to create extra tables for storing additional user information: Storing Additional User Information

这是另一种发布方式(我将采用这种方法),它实现了自己的配置文件提供程序,而不是使用默认的配置文件提供程序,因此您可以完全控制正在发生的事情,它的存储方式等.使用自定义配置文件提供程序管理Web用户

Here is another posting (I would take this approach), its implementing your own profile provider, rather than using default one, so you have full control over what is happening, how it stored etc.: Implementing Profile Provider in ASP.NET MVC Another great article by Microsoft about the same is Manage Web Users With Custom Profile Providers

这完全取决于实用程序和用途.您可以

It totally depends on utility and use. You can either

  1. 使用默认配置文件提供程序(执行)
  2. 使用自定义配置文件提供程序(小型网站)
  3. 使用您自己的表存储用户信息(企业级).

在后一种情况下,您可以通过在表中包含user.Guid来在默认成员资格(假设您使用默认成员资格提供程序)和自定义配置文件信息之间进行链接,默认成员资格将其用作唯一标识符.

In the latter case you can link between default membership (assuming you using default membership provider) and your custom profile information by including user.Guid inside your table, which is used by default membership as unique identifier.

希望此信息对您有帮助.

Hope this information will help you.

这篇关于ASP成员资格表->向用户添加新属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆