Currently I have a controller like this:
class AccountController : Controller {
public ActionResult Index() {
return View();
}
}
It's ok except one part that user when go to this page will have this url:
http://myhost/account/index
, which is unwanted. How can I have http://myhost/account
only ?
Something like this could do the trick
routes.MapRoute(
name: "Account",
url: "account/{action}/{id}",
defaults: new { controller = "Account", action = "Index", id = UrlParameter.Optional }
);
It could be also done with Attribute routing decorating with [Route]
the method you want to be the default.