[AllowAnonymous]
public class AuthController : Controller
{
[HttpGet]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginViewModel model)
{
if (ModelState.IsValid)
{
PartialLogin login = new PartialLogin();
if ((model.BusinessEmail != null && model.BusinessPassword != null) ||
(model.InvestorEmail != null && model.InvestorPassword != null))
{
if (login.ValidateBusinessLogin(model.BusinessEmail, model.BusinessPassword))
{
FormsAuthentication.SetAuthCookie(model.InvestorEmail, true);
Session["BusinessUserEmail"] = model.InvestorEmail;
return RedirectToAction("Index", "Business");
}
//if (login.ValidateInvestorLogin(model.InvestorEmail, model.InvestorPassword))
//{
if (model.InvestorEmail == "mahamQ@gmail.com")
{
FormsAuthentication.SetAuthCookie(model.InvestorEmail, true);
Session["InvestorUserEmail"] = model.InvestorEmail;
return RedirectToAction("Index", "Investor");
}
}
else
{
return RedirectToAction("Login", "Auth");
}
}
return View();
}
}
My original after clicking on Login on index page the url is Localhost/WebappCustom/Auth/Login, however after submitting the form, the url becomes as shown in the image and stays on the same login page rather than changing to localhost/WebAppCustom/Investor/Index