title: ASP.NET core form submit post method is not working while passing view model
body: <p>I am creating a login page for which I am sending email and password to controller using form submit post method. My code is as follows:</p>
  <p><strong>Html</strong></p>
  <pre><code>@model DishedendsCommon.Models.Login.LoginViewModel
  @{
      Layout = null;
      ViewBag.Title = &quot;dishedends login&quot;;
  }
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot; /&gt;
      &lt;link href=&quot;~/css/login.css&quot; asp-append-version=&quot;true&quot; rel=&quot;stylesheet&quot; /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  
      &lt;div class=&quot;login&quot;&gt;
          &lt;div class=&quot;login__form&quot;&gt;
  
              &lt;form asp-controller=&quot;Account&quot; asp-action=&quot;Login&quot; method=&quot;post&quot;&gt;
                  @*&lt;span class=&quot;material-icons&quot;&gt;lock&lt;/span&gt;*@
                  &lt;img src=&quot;~/image/logo-3.png&quot; alt=&quot;Alternate Text&quot; /&gt;
  
                  &lt;input id=&quot;ipEmail&quot; type=&quot;text&quot; Asp-for=&quot;Email&quot; placeholder=&quot;Email&quot; required /&gt;
                  &lt;span class=&quot;text-danger&quot; asp-validation-for=&quot;Email&quot;&gt;&lt;/span&gt;
  
                  &lt;input id=&quot;ipPassword&quot; type=&quot;password&quot; asp-for=&quot;Password&quot; placeholder=&quot;Password&quot; required /&gt;
                  &lt;span class=&quot;text-danger&quot; asp-validation-for=&quot;Password&quot;&gt;&lt;/span&gt;
  
                  &lt;button type=&quot;submit&quot; value=&quot;Login&quot;&gt;Login&lt;/button&gt;
              &lt;/form&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Controller:</p>
  <pre><code>namespace DishedendsWeb.Controllers
  {
      public class AccountController : Controller
      {
          [HttpGet]
          public ActionResult Login()
          {
              return View();
          }
  
          [HttpPost]
          public ActionResult Login(LoginViewModel model)
          {
              try
              {
                  if (ModelState.IsValid)
                  {
                      Console.WriteLine(model.Email);
                      return View();
                  }
              }
              catch (ApiCallException ex)
              {
                  // return HandleLoginPageError(ex, model);
              }
  
              return View(model);
          }
      }
  }
  </code></pre>
  <p>Model:</p>
  <pre><code>public class LoginViewModel
  {
          /// &lt;summary&gt;
          /// Email Address
          /// &lt;/summary&gt;
          [Required(ErrorMessage = &quot;Please enter your e-mail address.&quot;)]
          [EmailAddress(ErrorMessage = &quot;Please enter the correct email address.&quot;)]
          public string Email { get; set; }
  
          /// &lt;summary&gt;
          /// Password
          /// &lt;/summary&gt;
          [Required(ErrorMessage = &quot;Please enter your password.&quot;)]
          [DataType(DataType.Password)]
          public string Password { get; set; }
  
          /// &lt;summary&gt;
          /// Language
          /// &lt;/summary&gt;
          public string Language { get; set; } = &quot;en&quot;;
  
          /// &lt;summary&gt;
          /// FirstLogin
          /// &lt;/summary&gt;
          public bool FirstLogin { get; set; } = false;
  }
  </code></pre>
  <p>When I click on submit button, I get the following output:</p>
  <p><a href="https://i.stack.imgur.com/PuT2u.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PuT2u.jpg" alt="enter image description here" /></a></p>
  <p>I don't know, why it is not hitting the controller. Can you please help me.</p>
  <p><strong>Update</strong>
  FYI: I have created ASP .NET Core Web App (MVC)</p>
  <p>I have created web app and web API project in same solution (Also includes separate DB project).
  After adding the reference of API project in my web app project I am facing this problem.</p>
  <p><a href="https://i.stack.imgur.com/lAgWv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lAgWv.jpg" alt="enter image description here" /></a></p>
  <p>As I remove the API project reference, the above code works. I don't know why is it happening? Can someone help?</p>