applicationmanager

The name 'DefaultAuthenticationTypes' does not exist in the current context

て烟熏妆下的殇ゞ 提交于 2019-12-10 13:32:38
问题 I'm trying to implement role-based authorization in my web application like following: [HttpPost] [ActionName("Login")] public ActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { string userName = model.Username; string[] userRoles = (string[])Session["UserRoles"]; ClaimsIdentity identity = new ClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userName)); userRoles.ToList().ForEach((role) => identity.AddClaim