Define route and as the route template provide the following
"{*uri}"
so something like
config.MapRoute("DirectToHomeIndex", "{*uri}", new {controller = "Home", action = "Index"}
Pergunta
How can I route all requests to my HomeController
and my Index
Action?
So for example if a requested URL looks like this:
http://localhost/News/Tech/23
Then I'd like to "capture" that in my Index
action:
public class HomeController
{
public ActionResult Index (string uri)
{
// code
}
}
So in this case the string url
should contain: "News/Tech/23".
But I have no idea how to configure the route for this. Any idea how to do this?
Solução
Define route and as the route template provide the following
"{*uri}"
so something like
config.MapRoute("DirectToHomeIndex", "{*uri}", new {controller = "Home", action = "Index"}