Question

I managed the roles before with asp.net configuraition tool. I installed Mvc 4. I created a new mvc 4 internet app. It use simpleMembershipProvider and it is not compatible with asp.net configuration tool.

Is there any simple way to manage userRoles? Should I manage them with hardcode? And Could you give more information about simpleMembershipProvider? (usage, adventages, etc...)

Thanks I lot...

Was it helpful?

Solution

According to this page you need to either administer roles directly in the database or write your own pages to manage roles:

http://www.asp.net/web-pages/tutorials/security/16-adding-security-and-membership

The ASP.NET membership system is set up to support roles. However, unlike membership registration > and login, the Starter Site template does not contain pages that help you manage roles. (Managing > roles is an administrative task rather than a user task.)"

OTHER TIPS

This page contains a great overview of just about everything you need to know

http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx

Specifically on role management the options are as follows

WSAT is built to work with ASP.NET Membership, and is not compatible with Simple Membership. There are two main options there:

  • Use the WebSecurity and OAuthWebSecurity API to manage the users and roles

  • Create a web admin using the above APIs

  • Since SimpleMembership runs on top of your database, you can update your users as you would any other data - via EF or even in direct database edits (in development, of course)

After struggling with trying to code this myself and looking for step by step tutorials, I found this package that auto builds a very simple user/role management system. It will need to be extended to your project, but it should give you the start/example to build upon:

http://www.nuget.org/packages/SimpleMembershipAdministration/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top