如何处理ASP.NET MVC应用程序的成员资格?

时间:2022-11-04 07:28:21

How would you handle membership in an ASP.NET MVC application? Using any external libraries? How would you do OpenID log in? username log in? email log in? any other that is worth looking into? Maybe all of them mixed into the application?

您将如何处理ASP.NET MVC应用程序的成员资格?使用任何外部库?你会怎么做OpenID登录?用户名登录?电子邮件登录?还有什么值得研究的吗?也许所有这些都混合到应用程序中?

It seems ASP.NET comes with some pre-build user database (I'm totally new to .Net). The NerdDinner example uses it but then it makes the foreign keys use the username. That doesn't sound very good. Do you use this schema of two separate databases or only one? What do you use as the foreign key, any IDs?

ASP.NET似乎带有一些预构建的用户数据库(我对.Net来说是全新的)。 NerdDinner示例使用它,但它使外键使用用户名。这听起来不太好。您是使用这个两个独立数据库的模式还是只使用一个?您使用什么作为外键,任何ID?

I've found ASP.Net MVC Membership, anybody using it? does it work well? can it be expected to be maintained?

我找到了ASP.Net MVC会员资格,有人使用它吗?它运作良好吗?可以预期维持吗?

1 个解决方案

#1


Membership Providers are not new to ASP.Net MVC, they were introduced with ASP.Net 2.0. The Membership Provider model is simply an abstraction layer between your application and whatever source you are authenticating your users against. You can switch providers easily by simply changing your web.config file.

成员提供商并不是ASP.Net MVC的新手,它们是在ASP.Net 2.0中引入的。成员资格提供程序模型只是您的应用程序与您对用户进行身份验证的任何来源之间的抽象层。只需更改web.config文件即可轻松切换提供程序。

It is easy to write a membership provider, there are many walkthroughs on the web. Typically you would do so if you were using a database that used a different schema than the default examples that come with ASP.Net (which is most of the time). The foreign keys on the username thing in the NerdDinner example is a simplistic example that you would rarely see on any real-world databases.

编写会员提供者很容易,网上有很多演练。通常,如果您使用的数据库与ASP.Net附带的默认示例(大多数情况下)使用的模式不同,则会这样做。 NerdDinner示例中的用户名事项上的外键是一个简单的示例,您很少在任何真实数据库中看到它。

I would highly recommend using the Membership model. Controls like the Login control are built to make use of it, and it is well-designed and makes it easy to change or combine different login methods for your application. If you want to use OpenID, a quick google search brought up this OpenID Membership Provider.

我强烈建议使用会员模型。像Login一样的控件是为了使用它而构建的,它设计得很好,可以很容易地为您的应用程序更改或组合不同的登录方法。如果您想使用OpenID,快速谷歌搜索会带来这个OpenID会员提供商。

#1


Membership Providers are not new to ASP.Net MVC, they were introduced with ASP.Net 2.0. The Membership Provider model is simply an abstraction layer between your application and whatever source you are authenticating your users against. You can switch providers easily by simply changing your web.config file.

成员提供商并不是ASP.Net MVC的新手,它们是在ASP.Net 2.0中引入的。成员资格提供程序模型只是您的应用程序与您对用户进行身份验证的任何来源之间的抽象层。只需更改web.config文件即可轻松切换提供程序。

It is easy to write a membership provider, there are many walkthroughs on the web. Typically you would do so if you were using a database that used a different schema than the default examples that come with ASP.Net (which is most of the time). The foreign keys on the username thing in the NerdDinner example is a simplistic example that you would rarely see on any real-world databases.

编写会员提供者很容易,网上有很多演练。通常,如果您使用的数据库与ASP.Net附带的默认示例(大多数情况下)使用的模式不同,则会这样做。 NerdDinner示例中的用户名事项上的外键是一个简单的示例,您很少在任何真实数据库中看到它。

I would highly recommend using the Membership model. Controls like the Login control are built to make use of it, and it is well-designed and makes it easy to change or combine different login methods for your application. If you want to use OpenID, a quick google search brought up this OpenID Membership Provider.

我强烈建议使用会员模型。像Login一样的控件是为了使用它而构建的,它设计得很好,可以很容易地为您的应用程序更改或组合不同的登录方法。如果您想使用OpenID,快速谷歌搜索会带来这个OpenID会员提供商。