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 to开发者_如何学JAVAol 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
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.
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.
The MembershipStarterKit project might be of use.
精彩评论