且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用ASP.Net成员资格提供程序添加一个额外的字段?

更新时间:2022-11-05 16:55:38

正如jwsample所述,您可以为此使用配置文件提供程序.

As jwsample noted, you can use the Profile Provider for this.

或者,您可以创建自己的表来存储其他与用户相关的信息.由于您需要创建自己的表并创建用于在这些表之间获取和保存数据的代码,因此需要做更多的工作,但是我发现以这种方式使用自定义表可以提供更大的灵活性和更多的可维护性比配置文件提供程序(特别是默认配置文件提供程序SqlProfileProvider,它以低效,非规范化的方式存储配置文件数据).

Alternatively, you could create your own table(s) that store additional user-related information. This is a little more work since you're on the hook for creating your own tables and creating the code to get and save data to and from these tables, but I find that using custom tables in this way allows for greater flexibility and more maintainability than the Profile Provider (specifically, the default Profile Provider, SqlProfileProvider, which stores profile data in an inefficient, denormalized manner).

看一下本教程,我将逐步完成该过程:

Take a look at this tutorial, where I walk through this process: Storing Additional User Information.