Converting a regular ASP.NET site to MVC and I'm running into an issue with functionality that's easy in the existing site but confounding in MVC. The registration process, once completed, redirects to the Login page, passing the username and password, which logs in the user and displays a terms page since it's the first time the user is logging in.
The Login view in the MVC project has a Post action which does this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Login(Login login)
{
...
if (!u.TermsAccepted)
return RedirectToAction("AgreementPage", "Login");
}
I need the Registration controller to use this, but there doesn't appear to be a way to call a Post action from a different controller. The best I've been able to do is display the Login view, filling in the username and password. Any way to do this in MVC?
edit:
Should have added that the Login controller also has a Get:
[HttpGet]
public ActionResult Login()
{
ViewBag.ErrorMessage = "";
return View();
}
Using RedirectToAction calls this, not the Post:
Login login = new Login() { Username = info.UserInfo.UserName, Password = info.UserInfo.Password };
return RedirectToAction("Login", "Login", login);