如何使用 ASP.NET 会员资格提供程序获取预先存在的数据
我已经有了一个存储所有客户信息的表。例如姓名、电子邮件、电话、密码等。
在这种情况下,我如何利用 asp.net 会员/角色/配置文件提供程序的优势?
我想在MVC2中使用注释来进行身份验证等。
感谢您的建议,欢迎任何阅读网址。
I already got a table stored all customer information. Such as name, email phone, password and other things.
In this case, how can I take advantages of asp.net membership/role/profile provider?
I want to use annotation in MVC2 to do authentication and such.
Thanks for your advice, any reading URL is welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能需要创建自定义会员资格提供商。
查看:
MSDN 文章
ASP.Net Video
看看它们是否对您有帮助
You'll probably need to create custom membership provider.
Check out:
MSDN Article
ASP.Net Video
And see if they help you
有很简单的方法
1.使用aspnet_regsql.exe
(在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)
选择选项添加到现有数据库
使用您的姓名、电子邮件、电话(如个人资料),或者您可以创建自动添加用户的脚本(并且您需要添加到该用户电话、电子邮件等)
http://forums.asp.net/p/1540444/3753784.aspx
(这是有关 ASP.NET 角色、成员资格等的有用文档)
https://web.archive .org/web/20211020202857/http://www.4guysfromrolla.com/articles/120705-1.aspx
There are very simple way
1. use aspnet_regsql.exe
(in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)
Choose option add to existing database
Use your name, email, phone like Profile, or you can create script which add users automatically(and you need add to this user phone,email etc)
http://forums.asp.net/p/1540444/3753784.aspx
(It's useful documentation about asp.net roles,membership etc)
https://web.archive.org/web/20211020202857/http://www.4guysfromrolla.com/articles/120705-1.aspx
我抛出一个 CW 答案来比较/对比其他两个“真实”答案。
因此,您有两个选择: 按照 John 的回答,或者创建您自己的会员提供商并按照 user517656 的回答。
如果您使用标准提供程序,则必须将用户迁移到 Microsoft 数据库中。但一旦你这样做了,你就不需要编写太多代码了。
如果您使用自定义提供程序,则必须自己编写所有代码,但不必更改数据库。
I'm throwing in a CW answer to compare/contrast the other two "real" answers.
So you have two choices: Use the standard membership provider and their database schema as per John's answer, or create your own membership provider and utilize your current database as per user517656's answer.
If you use the standard provider, you'll have to migrate your users into the microsoft database. But once you do that, you shouldn't have to write much code at all.
If you use a custom provider you have to write all of the code yourself, but you don't have to change your database.