title: How to run LogOut Action In Home Controller that can not run by ActionLink?
body: <p>My Home Controller Like this:</p>
  
  <pre><code>public class HomeController : Controller
  {
  
  
      ....
  
  
      [ActionName("Login")]
      public ActionResult Login()
      {
          return View();
      }
  
      [HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Login(string UserName, string Password)
      {
          try
          {
              var query = user_Repository.Login(UserName, Password);
  
              if (query != null)
              {
  
  
                  Session["UserName"] = query.UserName;
                  Session["IsAdmin"] = query.IsAdmin;
  
                  return RedirectToAction("Index", "News");
              }
              ViewBag.ErrorMessage = "نام كاربري يا رمز عبور صحيح نمي باشد";
              return View();
  
  
  
          }
          catch (Exception e)
          {
              ViewBag.ErrorMessage = " خطا!!! ";
              return View();
          }
      }
  
  
      public ActionResult LogOut()
      {
          if (Request.Cookies["user"] != null)
          {
              var user = new HttpCookie("user")
              {
                  Expires = DateTime.Now.AddDays(-1),
                  Value = null
              };
              Response.SetCookie(user);
              Response.Cookies.Clear();
  
          }
          if(Session["UserName"] != null)
          {
              Session["UserName"] = null;
              Session["IsAdmin"] = null;
          }
          Session.Clear();
          return RedirectToActionPermanent("Index");
      }
  }
  </code></pre>
  
  <p>When i Use ActionLink in _Layout to Run Logout Action in Home Controller , this ActionLink Instead of executing Logout Action, Login will be executed!!!
  My ActionLink Like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  @Html.ActionLink("Log Off", "LogOut", "Home")</code></pre>
  </div>
  </div>
  </p>
  
  <p>where is my wrong??? why @Html.ActionLink("Log Off", "LogOut", "Home") run Login Action????????????????????</p>
  
  <p>i use this code for run that LogOut Action in my _Layout and this code work Correct...</p>
  
  <pre><code> @using (Html.BeginForm("LogOut", "Home", FormMethod.Post, new { role = "form" }))
                                      {
                                          @Html.AntiForgeryToken()
                                          &lt;input type="submit" value="خروج" class="btn btn-primary" /&gt;
                                      }
  </code></pre>
  
  <p>This is a text that stackOverflow lets me send the text because stackOverflow says i should give more explanations and say "it looks like your post is mostly code; please add some more details"!!!  i dont have any more detail.... i explain all of that ;)</p>