How do i configure optional flags in MVC 1.0 routes
- by Thomas Jespersen
I want to configure a route with optional flags.
E.g. I want to be able to call the products page and send optional filters (flags) for offers and in stock options. If the flags are NOT specified then all products should be returned.
http://localhost/products
http://localhost/products/onlyOnOffer
http://localhost/products/onlyInStock
http://localhost/products/onlyInStock/onlyOnOffer
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult GetProducts(bool onlyInStock, bool onlyOnOffer)
{
//...
}
How would I configure the route? Is it even possible in MVC 1.0? What about MVC 2.0.