c# - MVC 4 post automatically redirect to action that i dont want -
i have problem asp.net mvc 4 application. have partial view fallowing code:
<li>@using (html.beginform("logoff", "account", formmethod.post, new { id = "logoutform", style = "display: inline;" })) { @html.antiforgerytoken() <a href="javascript:document.getelementbyid('logoutform').submit()">log out</a> } </li>
and after click "log out" im redirected to: /account/login?returnurl=%f2account%f2logoff , going action:
// // get: /account/login [allowanonymous] public actionresult login() { viewbag.title = logintitle; return view(); }
but want handle in action:
[httppost] [validateantiforgerytoken] public actionresult logoff() { session["user"] = null; return redirecttoaction("index", "index"); }
can me?
it looks not logged in during logging off.
Comments
Post a Comment