[HttpPost] public IActionResult AppUserLogin(AppUser user) { string connectionString = "server=db4free.net;database=rpxxxxx;uid=rpxxxx;pwd=rpxxxxx;"; MySqlConnection connection = new MySqlConnection(connectionString); try { connection.Open(); string sql = "SELECT Email,Password FROM AppUser WHERE Email= '" + user.Email + "' AND password = '" + user.Password + "'"; MySqlCommand command = new MySqlCommand(sql, connection); command.ExecuteNonQuery(); TempData["Msg"] = "Successfully login!"; connection.Close(); } catch (Exception ex) { TempData["Msg"] = "Incorrect email or password"; } return RedirectToAction("Main"); }