How do i configure optional flags in MVC 1.0 routes
Posted
by Thomas Jespersen
on Stack Overflow
See other posts from Stack Overflow
or by Thomas Jespersen
Published on 2010-05-06T13:24:41Z
Indexed on
2010/05/06
13:28 UTC
Read the original article
Hit count: 305
asp.net-mvc
|.NET
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/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.
© Stack Overflow or respective owner