I'm using asp.net and trying to assign roles for a user with forms authentication like this:
public ActionResult AdminLogin(string password, string username) { User _user = _us.GetUsers(username, password).FirstOrDefault(); if (_user != null) { string _username = _user.Username; FormsAuthentication.SetAuthCookie(_username, false); string[] _roles = _us.GetUserRoles(_username); HttpContext.User = new GenericPrincipal(HttpContext.User.Identity, _roles); return RedirectToAction("Index", "Admin"); When I debug HttpContext.User.Identity always is null, but _username and _roles contains the proper data. Howto fix this?
/M