Why is the RedirectToAction
not working and the URL does not change to /Home/Second
when I make a post request to the Login
?
Using AngularJS:
$scope.answer = function(answer) {
$mdDialog.hide(answer);
$http({
method: 'POST',
url: 'Home/Login',
data: JSON.stringify({ email: $scope.user.email, password: $scope.user.password })
});
};
In the HomeController:
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult Second()
{
return View();
}
[HttpPost]
public ActionResult Login(string email,string password)
{
return RedirectToAction("Second");
}
}