Author: wardy_boy1972 | Posted on: 11/28/2009 5:57:30 PM | Views : 258

Hi there
I want to use [Autorize(Roles="admin")] to protect my controller methods but i'm not quite sure how it works. I've set up Form Authentication no problem so without roles it works ok
 In my controller I have the following code when thu user logs on but once logged in I want to set the cookie and then only a user with the role 'admin' can access /Test. Can somebody explain where the Roles in [Autorize(Roles="admin")] actually looks for its data? I want it to recognise only 'admin' from currently logged on users but also when they return and get the role data from the cookie. Am I missing something, lacking understanding or just going about it the wrong way?
public ActionResult Authenticate(string username, string password, string rememberMe) { var user = userRepository.GetUserByName(username); if (user != null && user.passwo ...

Go to the complete details ...