_Layout:
@if (User.Identity.IsAuthenticated)
{
<li>@Html.DropDownList("User", new List<SelectListItem>
{
new SelectListItem { Text = User.Identity.Name, Value = "1", Selected = true },
new SelectListItem { Text = "Logout", Value = "2" }
})</li>
}
When the user clicks on the logout option drop down list I need to call the Logout() method like you can with ActionLinks. How do I do this?
Edit: Signout isn't working with new jquery code. Why is this?
public ActionResult Logout()
{
FormsAuthentication.SignOut();
return View("../Home/Index");
}
My old code still works though by logging user off though.
<li>@Html.ActionLink("Logout", "Logout", "Users", new { }, new { @class = "nav-link" })</li>