I'm currently trying to change a few URL's for Google Analytics, as I want the URL in the google sites to be easier to read.
Right now, My login page is at the root, and the dashboard page is also at root. However, I want my login page to display as www.somesite.com/login, when the user types in www.somesite.com. As of right now, this login page exist at accounts/login, which would display www.somesite.com/accounts/login.
Is it possible for me to edit the RouteConfig file to display /login when the controller accounts and action login is hit? Currently, this does not work:
routes.MapRoute(
name: "Default",
url: "Login/{controller}/{action}/{id}",
defaults: new
{
controller = "Accounts",
action = "Login",
id = UrlParameter.Optional
},
namespaces: new[] { "somenamespace" }
);
The action being called:
public ActionResult Logon()
{
return View(ViewModel.CreateModelForPageLoad<LogOn>());
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Logon(Logon model)
{
//Log in code
}