成员资格和 asp.net MVC
我正在构建一个网站,需要使用不同角色和权限创建的用户来访问网站的不同区域。
我使用 mvc 2,但我找不到关于使用 mvc 的会员工具来创建帐户和角色等的明确指导。
我尝试了有效的 Web 配置工具,但我想远程管理该网站。
我使用了 aspnet_regsql 工具,这样我就可以访问数据库中的 SqlMembershipProvider 架构。
我还需要向用户添加更多信息,例如个人资料信息和图片,我会将这些添加到会员资格表中还是为此创建单独的表?
任何建议或帮助真的会有帮助吗?
谢谢杰姆斯
I’m building a site that needs users created with different roles and permissions to access different areas of the site.
I using mvc 2 but I can’t find much clear guidance on using the Membership tool with mvc to create accounts and roles etc.
I tried the web configuration tool which works but I would like to administrate the site remotely.
I used the aspnet_regsql tool so I can access the SqlMembershipProvider Schema in my Database.
I also need to add more information to a user like profile info and a picture, would I add these to the membership tables or create separate tables for this?
Any advice or help would be really helpful?
Thanks
Jemes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我一直发现,最好创建自己的成员资格提供程序,而不是使用通过 regsql 工具免费获得的默认 ASP.NET MVC 成员资格服务。不要害怕打开帐户会员服务(IMmembershipService 的后代)并开始使用它。
当开始一个新的 ASP.NET MVC 2 项目时,我做的第一件事就是将帐户类分解为一个简单的提供程序,并在我的 SQL Server 数据库中使用我自己的用户表。
由于会员服务实现了 IMembershipService 接口,因此您可以轻松地使用自己的业务对象框架重新开始并实现该接口。
首先让您的用户工作。一旦您的用户开始工作并登录,就返回并创建您的角色表。
I have always found that it is better to create your own membership provider rather than use the default ASP.NET MVC membership service that you get for free with the regsql tool. Don't be afraid to open up the Account Membership Service (the descendant of IMembershipService) and start playing around with it.
The first thing I do when starting a new ASP.NET MVC 2 project is to gut the account classes down to a simple provider and use my own Users table in my SQL Server database.
Since the membership service implements the IMembershipService interface, it will be easy for you to start over using your own business object framework and implement the interface.
Get your Users working first. Then come back and create your roles tables once you have your Users working and logging in.
它与 asp.net 中的机制相同。
https://web. archive.org/web/20210513220018/http://aspnet.4guysfromrolla.com/articles/120705-1.aspx
http://netrsc.blogspot.com/2009/ 04/membership-management-for-aspnet-mvc.html
每当我需要有关用户的更多信息时,我都会创建自己的个人资料信息表。不要因为升级而更改生成的成员资格表。
It's the same mechanism as in asp.net.
https://web.archive.org/web/20210513220018/http://aspnet.4guysfromrolla.com/articles/120705-1.aspx
http://netrsc.blogspot.com/2009/04/membership-management-for-aspnet-mvc.html
Whenever I need some more info about user I create my own profile info table. Do not change the generated membership tables because of upgrades.
MembershipStarterKit 项目可能有用。
The MembershipStarterKit project might be of use.