title: Login submit button unable to Reach [httpost]
body: <p>Here I'm trying to create login page using asp.net MVC4 application, but unable to check the database data using <code>HttpPost</code></p>
  
  <pre><code>[HttpGet]
      public ActionResult LogIn(string returnUrl = "")
      {
          if (User.Identity.IsAuthenticated)
          {
              return LogOut();
          }
  
          ViewBag.ReturnUrl = returnUrl;
          return View();
      }
  
      [HttpPost]
      public  bool ValidateUser(string UserID, string Password)
      {
          if (string.IsNullOrEmpty(UserID) || string.IsNullOrEmpty(Password))
              return false;
  
          using (ntc_salesEntities context = new ntc_salesEntities())
          {
              var user = (from u in context.user_master
                          where String.Compare(u.UserID, UserID, StringComparison.OrdinalIgnoreCase) == 0
                                &amp;&amp; String.Compare(u.Password, Password, StringComparison.OrdinalIgnoreCase) == 0
                           select u).FirstOrDefault();
  
              return user != null;
          }
      }
  
      [HttpPost]
      public ActionResult Login(Models.user_master model, string returnUrl = "")
      {
         // if (ModelState.IsValid)
        //  {
              if (Membership.ValidateUser(model.UserID,model.Password))
              {
                  FormsAuthentication.RedirectFromLoginPage(model.UserID,false);
                  return RedirectToAction("Index", "Login");
              }
              else
              {
                  ModelState.AddModelError("", "Login details are wrong.");
              }
              return View(model);
         // }
      }
  </code></pre>
  
  <p>Login:</p>
  
  <pre><code>@model Loginusingmvc.Models.user_master
  
  @{
     ViewBag.Title = "LogIn";
     Layout = "~/Views/Shared/_Layout.cshtml";
    }
  
  @Html.ValidationSummary(true, "Login Failed, check details")
  
  &lt;div&gt;
      @using (Html.BeginForm("Login", "Login", new { returnUrl = Request.QueryString["returnUrl"] }, FormMethod.Post))
      {
      &lt;fieldset&gt;
          &lt;legend&gt;Login Form&lt;/legend&gt;
          &lt;div class="editor-label"&gt;@Html.LabelFor(u=&gt; u.UserID)&lt;/div&gt;
          &lt;div class="editor-field"&gt;@Html.TextBoxFor(u=&gt; u.UserID)
              @Html.ValidationMessageFor(u=&gt; u.UserID)
          &lt;/div&gt;
          &lt;div class="editor-label"&gt;@Html.LabelFor(u=&gt; u.Password)&lt;/div&gt;
          &lt;div  class="editor-field"&gt;@Html.PasswordFor(u=&gt; u.Password)
              @Html.ValidationMessageFor(u=&gt; u.Password)
          &lt;/div&gt;
  
          &lt;input type="submit" value="Log In" name="Login" /&gt;
  
      &lt;/fieldset&gt;
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>Routing:</p>
  
  <pre><code>    public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Login", action = "LogIn", id =    
            UrlParameter.Optional }
          );
      }
  </code></pre>