I am encountering an issue with my login page while using Angular in a View. After the "RedirectToLocal" command is executed, I can see that it hits my Home Controller and returns the Index view successfully. However, the browser does not actually navigate to the Index page and remains stuck on the Login screen. This puzzling behavior has me scratching my head.
Account Controller
[Authorize]
[InitializeSimpleMembership]
public class AccountController : Controller
{
[HttpPost]
[AllowAnonymous]
public ActionResult Login(LoginFormModel form, string selectedShow)
{
if (ModelState.IsValid && WebSecurity.Login(form.userName, form.password))
{
...code here...
}
return RedirectToLocal("/"); //HITS HERE SUCCESSFULLY
Home Controller
[Authorize]
public class HomeController : Controller
{
public ActionResult Index()
{
return View(); //HITS HERE SUCCESSFULLY
}
}
Edit:
HTML & Angular
<button id="loginBtn" ng-click="login()" ng-class="{ 'disabled': isLoading }" class="btn btn-large btn-primary btn-block">
<span>{{buttonText}}</span>
</button>
Angular LoginController:
AccountFactory.login($rootScope.formData);
Account Factory
AccountFactory.login = function (formData) {
return $http({
method: 'POST',
url: '/Account/Login',
data: formData
});
};