asp.net mvc - MVC AuthenticationManager.SignOut() is not signing out -
my project based on mvc 5 project template visual studio 2013 (individual user account option). have been relying on default sign in , sign out method users. i'm not sure did, @ point, users cannot sign out anymore, can sign in user.
this default logoff method of account controller
[httppost] [validateantiforgerytoken] public actionresult logoff() { authenticationmanager.signout(); return redirecttoaction("index", "home"); } private iauthenticationmanager authenticationmanager { { return httpcontext.getowincontext().authentication; } }
this default _loginpartial.cshtml view shows user's username.
@using microsoft.aspnet.identity @if (request.isauthenticated) { using (html.beginform("logoff", "account", formmethod.post, new { id = "logoutform", @class = "navbar-right" })) { @html.antiforgerytoken() <ul class="nav navbar-nav navbar-right"> <li> @html.actionlink("hello " + user.identity.getusername() + "!", "index", "manage", routevalues: null, htmlattributes: new { title = "manage" }) </li> <li><a href="javascript:document.getelementbyid('logoutform').submit()">log off</a> </li> </ul> } } else { <ul class="nav navbar-nav navbar-right"> <li>@html.actionlink("register", "register", "account", routevalues: null, htmlattributes: new { id = "registerlink" })</li> <li>@html.actionlink("log in", "login", "account", routevalues: null, htmlattributes: new { id = "loginlink" })</li> </ul> }
when user signs out, directs user login page, user's username still shown means have not signed out. , url on browser shows http://localhost/account/login?returnurl=%2faccount%2flogoff
it not taking user index page of home. guess happened @ statement authenticationmanager.signout();. i'm confused because haven't changed account controller.
any lead appreciated.
i had same problem. check issue on codeplex:
https://aspnetidentity.codeplex.com/workitem/2347
i hope you. :-)
Comments
Post a Comment