[RESOLVED]how to do my LOG OUT button form as link?

Hi, i have the classic MVC button LOG OUT, but i would like to do a  normal link, someone can help me to create the new code (link + code controller)?

Thanks

hi

in view :

<a href="/Account/LogOut">LogOut</a>

in controller :

public class AccountController : Controller
{ 
        public ActionResult LogOut()
        {
            FormsAuthentication.SignOut();
            return Redirect("/");
        }
}

Don’t use GET links there are security concerns. Use POST instead

Leave a Reply