如何处理 ASP.NET MVC 应用程序中的成员身份?
您将如何处理 ASP.NET MVC 应用程序中的成员身份? 使用任何外部库? 您将如何登录 OpenID? 用户名登录? 电子邮件登录? 还有其他值得研究的吗? 也许它们全部混合到应用程序中?
ASP.NET 似乎附带了一些预构建的用户数据库(我对 .Net 完全陌生)。 NerdDinner 示例使用它,但随后它使外键使用用户名。 听起来不太好。 您使用两个独立数据库的这种模式还是仅使用一个? 你用什么作为外键,有ID吗?
我找到了ASP.Net MVC Membership,有人使用它吗? 效果好吗? 可以指望维持下去吗?
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?
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?
I've found ASP.Net MVC Membership, anybody using it? does it work well? can it be expected to be maintained?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
成员资格提供程序对于 ASP.Net MVC 来说并不陌生,它们是在 ASP.Net 2.0 中引入的。
成员资格提供程序模型只是您的应用程序与您用于对用户进行身份验证的任何源之间的抽象层。 您只需更改 web.config 文件即可轻松切换提供商。
编写会员提供程序很容易,网上有很多演练。 通常,如果您使用的数据库使用的架构与 ASP.Net 附带的默认示例(大多数情况下)不同,您就会这样做。 NerdDinner 示例中用户名上的外键是一个简单的示例,您在任何现实世界的数据库中都很少看到。
我强烈推荐使用会员模式。 像登录控件这样的控件就是为了利用它而构建的,它经过精心设计,可以轻松更改或组合应用程序的不同登录方法。 如果您想使用 OpenID,通过 Google 快速搜索即可找到此OpenID 会员提供商。
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.
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.
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.