I use asp.net mvc3 and I want to write route that has no end.. I mean something like that:
www.site.com/Cameras/{id}={string}/{id}={string}/{id}={string}/{id}={string}.....
where the id represent a filter id and the string represent a value of that filter.. I have many types of filters and in the future I want to be able to add more without any dependence.. How should this kind of route should look? And how do I start to deal these parameters?
What you need to do is write a catchall route and then interpret it like this:
routes.MapRoute("Cameras", "cameras/{*url}",
new { controller = "Cameras", action = "Index" }
);
public ActionResult Index(string url)
{
var ids = url.split('/');
// now do what you need with the ids
}
You should use urls like this:
/cameras/id1/id2/id3/id4