I have a standard Home controller and in it the POST method and after any changes in the controller, ceases to see this method, and in order to fix this you need to again register this controller with the same name in the form action , only after that it starts working again. I am a beginner in asp.net and this moment is incomprehensible to me, I use Visual Studio 2017

 <form method="post" action="Login"> <table class="tableLogin"> <tr class="tableLoginText" ><td><input class="input" type="text" name="Username" placeholder="Имя пользователя" /> </td></tr> <tr class="tablePasswordText"><td> <input class="input" type="password" name="Password" placeholder="Пароль" /> </td></tr> <tr class="tableButtonLogin"><td> <input class="buttonLgn" type="submit" name="ButtonLogin" value="ВОЙТИ" /> </td></tr> </table> </form> 

Method from the controller.

 [HttpPost] [Route("Login")] public string Login(LoginUser user) { if (user.Username == null || user.Password == null) { return "<h1>Неверные значения логина или пароля</h1>"; } return user.Username + user.Password; } 
  • And what method of the controller returns View? - Igor
  • @Igor Standard, `public ActionResult Index () {return View (); } ` - Identicon

0