asp.net web 应用程序项目模板 会员资格
我想在创建新的 ASP.NET Web 应用程序时使用 Visual Studio 中默认包含的内置成员资格/身份验证系统。
我的问题是我有一个用户表... UserID、FirstName、LastName 等,其中包含我想要使用的公司信息。如何将此表链接到我创建的新注册?
假设我创建了一个新的注册。现在登录名和密码数据存储在哪里?
有人能指出我正确的方向吗?
I would like to use the built-in membership / authentication system that is included by default in Visual Studio when creating a new asp.net web application.
My question is I have a user table... UserID, FirstName, LastName, etc. with company info that I want to use. How do I go about linking this table to the new registration I created?
Suppose I created a new registration. Now where is the login and password data being stored?
Can anyone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
本教程在开始时非常有帮助: 在 SQL Server 中创建成员资格架构。
如果您现有的公司数据库中基本上只有用户个人资料信息,则可能需要考虑创建 自定义配置文件提供程序。请注意,在使用 Web 应用程序项目时执行此操作有其 怪癖。
如果您的数据库中还有通过外键链接到用户的其他信息,您可能会对这个讨论如何将其与会员资格一起使用。
This tutorial can be very helpful at the beginning: Creating the Membership Schema in SQL Server.
If you have basically only user profile information in your existing company database, may be you'll need to consider creating a custom Profile Provider. Be aware that doing it while using the Web Application Project has its perculiarities.
If you have also other information in your database linked to user by foreing keys, may be you'll be interested in this discussion on how to use it with Membership.
默认情况下,成员资格信息存储在 SQL 数据库 ASPNETDB.MDF 中。您可以在 App_data 文件夹中找到该文件。
如果您想更改成员资格的行为方式以及它使用的数据库和表,我建议创建一个自定义成员资格提供程序。
请参阅 http://msdn.microsoft.com/en-us/library/aa479048。 aspx 或 google asp.net 自定义会员资格提供程序:
如果您只想现有会员资格提供程序使用不同的数据库,您可以运行 aspnet_regsql 实用程序:
请参阅 http://weblogs.asp.net/scottgu/archive/2005/08 /25/423703.aspx
这个使用实体框架 codefirst 的自定义成员资格提供程序示例帮助我入门:
http://codefirstmembership.codeplex.com/
The membership info is stored in a SQL database ASPNETDB.MDF by default. You can find this file in your App_data folder.
If you want to change the way membership behaves, and which database and tables it uses I would recommend creating a custom membership provider.
See http://msdn.microsoft.com/en-us/library/aa479048.aspx or google asp.net custom membership provider:
If you just want the existing membership provider to use a different database you can run the aspnet_regsql utility:
See http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx
This example of a custom membership provider that uses entity framework codefirst helped me to get started:
http://codefirstmembership.codeplex.com/
我的拙见是,您只需创建一个单独的表并将其与具有关系的用户表相关联。因此,登录名和密码的存储位置没有变化。
本文可能对您有帮助: http://www.asp.net /security/tutorials/storing-additional-user-information-cs 。看看它。
其他文章:
https://web.archive.org/web/20211020111657/https://www.4guysfromrolla.com/articles/101106-1.aspx
https://web.archive.org/web/20211020114106/https://www.4guysfromrolla.com/articles/110310-1.aspx
希望这会有所帮助。
My humble suggestion is that you simply create a seperate table and relate it to your user table with a realtionship. So there is no change about where the login and password are stored.
This article might help you : http://www.asp.net/security/tutorials/storing-additional-user-information-cs . Take a look at it.
Additional Articles:
https://web.archive.org/web/20211020111657/https://www.4guysfromrolla.com/articles/101106-1.aspx
https://web.archive.org/web/20211020114106/https://www.4guysfromrolla.com/articles/110310-1.aspx
Hope this helps.
感谢大家的回复,你们给了我一些见解,帮助我解决了我的问题。
我决定走一条更容易的路。
这就是我想出来的。在Register.aspx.cs中:
并添加了CreateUserWizard控件中的控件。非常简单的解决方案。
Thanks all for your replies, you all gave me some insight to help me figure out my problem.
I decided to take an easier route.
This is what I came up with. In Register.aspx.cs:
And added the controls in the CreateUserWizard control. Pretty simple solution.