0

i have the index

 public ActionResult Index()
        {
            ClaimsIdentity nd = new ClaimsIdentity(new List<Claim>{ new Claim("role","manager") });
            ClaimsPrincipal.Current.AddIdentity(nd);

            FormsAuthentication.SetAuthCookie("user",true);

            return View();
        }

where i login and set some claims.

then i have a about where i signout.

public ActionResult About()
        {
            FormsAuthentication.SignOut();

            return View();
        }

Afterwards i try to access the claim in the contact view.

public ActionResult Contact()
        {
            var firstclaims = ClaimsPrincipal.Current.Claims.FirstOrDefault();

            return View();
        }

And for some reason it is still there.I even cleaned out my cookies but still that claim is still there.

Aflred
  • 4,435
  • 6
  • 30
  • 43

1 Answers1

0

Your problem that you are mixing Forms Authentication and MembershipProvider with a new framework Asp.Net Identity. If you are using claims and Identity, then don't use FormsAuthentication methods and related.

If you need an example how this works, create a new project in Visual Studio 2013 with MVC and Individual Authentication and look through the code given in the template.

trailmax
  • 34,305
  • 22
  • 140
  • 234