Reputation: 255
Basically, in my controller I'm redirecting to the Index action:
return RedirectToAction("", new { id = id });
This works great except for the fact that the URL bar displays controllername/index/id
. I would like to be able to avoid displaying "Index" in the URL. Is this possible? And if so, how?
Upvotes: 1
Views: 443
Reputation: 14618
Add a route without the action name in your global.asax.cs
:
routes.MapRoute("NoActionInURL", "ControllerName/{id}",
new { controller = "ControllerName", action = "Index", id = UrlParameter.Optional });
Upvotes: 4