{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/5280","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/5280/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/5280/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/5280/events","html_url":"https://github.com/aspnet/Mvc/issues/5280","id":176897910,"number":5280,"title":"Working with cookie in mvc","user":{"login":"rpundlik","id":7088840,"avatar_url":"https://avatars.githubusercontent.com/u/7088840?v=3","gravatar_id":"","url":"https://api.github.com/users/rpundlik","html_url":"https://github.com/rpundlik","followers_url":"https://api.github.com/users/rpundlik/followers","following_url":"https://api.github.com/users/rpundlik/following{/other_user}","gists_url":"https://api.github.com/users/rpundlik/gists{/gist_id}","starred_url":"https://api.github.com/users/rpundlik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rpundlik/subscriptions","organizations_url":"https://api.github.com/users/rpundlik/orgs","repos_url":"https://api.github.com/users/rpundlik/repos","events_url":"https://api.github.com/users/rpundlik/events{/privacy}","received_events_url":"https://api.github.com/users/rpundlik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/Mvc/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/aspnet/Mvc/milestones/18","html_url":"https://github.com/aspnet/Mvc/milestones/Discussions","labels_url":"https://api.github.com/repos/aspnet/Mvc/milestones/18/labels","id":1254581,"number":18,"title":"Discussions","description":"","creator":{"login":"Eilon","id":202643,"avatar_url":"https://avatars.githubusercontent.com/u/202643?v=3","gravatar_id":"","url":"https://api.github.com/users/Eilon","html_url":"https://github.com/Eilon","followers_url":"https://api.github.com/users/Eilon/followers","following_url":"https://api.github.com/users/Eilon/following{/other_user}","gists_url":"https://api.github.com/users/Eilon/gists{/gist_id}","starred_url":"https://api.github.com/users/Eilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eilon/subscriptions","organizations_url":"https://api.github.com/users/Eilon/orgs","repos_url":"https://api.github.com/users/Eilon/repos","events_url":"https://api.github.com/users/Eilon/events{/privacy}","received_events_url":"https://api.github.com/users/Eilon/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":13,"state":"open","created_at":"2015-08-14T02:04:42Z","updated_at":"2016-09-21T15:48:24Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-09-14T12:46:22Z","updated_at":"2016-09-26T16:52:56Z","closed_at":"2016-09-14T21:27:10Z","body":"I have 2 different urls to login into the application as follows\r\n\r\nFor Trainee:- [http://localhost:56739/trainee/Login/myclientname]()\r\n\r\nFor Admin:- [http://localhost:56739/admin/Login/myclientname]()\r\n\r\nI am logging into the application using the below default login implementation\r\n\r\n`var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: true);`\r\n\r\nWhat i observed the method `PasswordSignInAsync `is creating the cookie for logged in user.\r\n\r\nHowever my issue is if I logged in using `trainee` url and tries to access the `admin` url then user is directly getting logged in into the admin application without asking for login, because of the cookie. Means the cookie is getting accessed/shared between trainee and admin.\r\n\r\nMy views are different for `admin/trainee` but they are in same project with below folder structure. http://i.stack.imgur.com/HyOhW.png\r\n\r\nWhen i checked in the layout page for below line of code when switching between trainee and admin, this `IsAuthenticated`coming true though the admin is still not logged into the application and vice versa.\r\n\r\n `@if (User.Identity.IsAuthenticated)`\r\n\r\nI am using core identity framework for user authentication.\r\n\r\nHow can i maintain the separate cookie while switching between `admin/trainee` ?\r\n\r\nThanks for the help ! "},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/249628446","html_url":"https://github.com/aspnet/Mvc/issues/5280#issuecomment-249628446","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/5280","id":249628446,"user":{"login":"HaoK","id":6537861,"avatar_url":"https://avatars.githubusercontent.com/u/6537861?v=3","gravatar_id":"","url":"https://api.github.com/users/HaoK","html_url":"https://github.com/HaoK","followers_url":"https://api.github.com/users/HaoK/followers","following_url":"https://api.github.com/users/HaoK/following{/other_user}","gists_url":"https://api.github.com/users/HaoK/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoK/subscriptions","organizations_url":"https://api.github.com/users/HaoK/orgs","repos_url":"https://api.github.com/users/HaoK/repos","events_url":"https://api.github.com/users/HaoK/events{/privacy}","received_events_url":"https://api.github.com/users/HaoK/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T16:52:56Z","updated_at":"2016-09-26T16:52:56Z","body":"You should really use a claim for the user to determine which role they are (user vs admin) as opposed to using different urls.  Then you could just use IsInRole(\"admin\") instead.  That is the expected usage for the scenario you are targetting.\r\n\r\n"}}
{"actor":{"display_login":"HaoK"}}