I have the following controller
public class AccountController : Controller
{
[HttpPost]
public ActionResult Login(string email, string password)
{
if (!ModelState.IsValid) return View();
if (Membership.ValidateUser(email, password))
{
FormsAuthentication.SetAuthCookie(email, false);
return RedirectToAction("Index", "Home");
}
ModelState.AddModelError("", "Wrong username or password");
return View();
}
[HttpGet]
public ActionResult Logout()
{
FormsAuthentication.SignOut();
return RedirectToAction("Login", "Account");
}
}
The HomeController
public class HomeController : Controller
{
public ActionResult Index()
{
if (Request.Path.EndsWith("/"))
{
return View();
}
if (Request.Url != null)
{
return RedirectPermanent(Request.Url + " /");
}
return View();
}
}
Routing is like that
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}/{email}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional , email=UrlParameter.Optional}
);
}
But when i put the application on IIS and i run it gives me 404 not found when navigating to root of the site (I'd expect it to match the route that redirects to HomeController.Index Action)