asp.net web 应用程序项目模板 会员资格

发布于 2024-11-19 12:09:13 字数 213 浏览 1 评论 0原文

我想在创建新的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我不在是我 2024-11-26 12:09:14

本教程在开始时非常有帮助: 在 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.

墨离汐 2024-11-26 12:09:14

默认情况下,成员资格信息存储在 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/

柠檬心 2024-11-26 12:09:14

我的拙见是,您只需创建一个单独的表并将其与具有关系的用户表相关联。因此,登录名和密码的存储位置没有变化。

本文可能对您有帮助: 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.

青柠芒果 2024-11-26 12:09:14

感谢大家的回复,你们给了我一些见解,帮助我解决了我的问题。
我决定走一条更容易的路。

这就是我想出来的。在Register.aspx.cs中:

protected void RegisterUser_CreatedUser(object sender, EventArgs e)
{

    TextBox txtFirstName = (TextBox)(RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txtFirstName "));
    string firstName= txtFirstName.Text;

    ... Insert new fields  in database ....

}

并添加了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:

protected void RegisterUser_CreatedUser(object sender, EventArgs e)
{

    TextBox txtFirstName = (TextBox)(RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("txtFirstName "));
    string firstName= txtFirstName.Text;

    ... Insert new fields  in database ....

}

And added the controls in the CreateUserWizard control. Pretty simple solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文