1

i like to implement authentication with roles. I will use javascript to login, register etc... I'm a litte bit overwhelmed with this approach. Where can i define roles (I used the empty mvc4 template) ? Any step trough step guide ?

tereško
  • 58,060
  • 25
  • 98
  • 150
MR.ABC
  • 4,712
  • 13
  • 44
  • 88
  • 1
    what's wrong with the simplemembership/universal provider? Why aren't you using the built-in authentication/authorization system? – Jeroen Vannevel Jun 17 '13 at 01:05
  • @Jeroen Vannevel because i do not know how to use it. Can i define restrictions for a controller for some kind of users ? – MR.ABC Jun 17 '13 at 01:07
  • 2
    Yes, that's as easy as putting `[Authorize(roles="admin")]` on top of a controller. I suggest you start looking there and come back with specific issues, the ASP.NET auth framework is thoroughly tested and better than anything you'll come up with. I've implemented it in an application just a few days ago, this answer got me immediatly where I needed to be in order to adjust it so I can store my own userdata in the database. http://stackoverflow.com/questions/15776640/how-can-i-customize-simple-membership-provider-to-work-with-my-own-database-asp/15901791#15901791 That's all there is to it. – Jeroen Vannevel Jun 17 '13 at 01:09
  • thanks was easy. had some trouble with wcf auth and was relating this to it. – MR.ABC Jun 17 '13 at 02:48

0 Answers0