i'm using asp.net mvc with vs2008 and IIS7. What i want to accomplish is that all requests that START WITH 'summer' are routed to the same controller. 'till now i've built tons of routes, but they were all for one path (with parameters offcourse) but this one must route: www.mysite.com/summercity www.mysite.com/summermadness www.mysite.com/summer www.mysite.com/summerweather
to the same controller.
the only solution i've come up with is 'summer*', but that didn't work :)
Michel
A Wildcard route has a path consisting of two asterisks (**). It matches every URL, the router will select this route if it can't match a route earlier in the configuration. A Wildcard Route can navigate to a custom component or can redirect to an existing route.
Multiple Routes You need to provide at least two parameters in MapRoute, route name, and URL pattern. The Defaults parameter is optional. You can register multiple custom routes with different names.
ASP.NET MVC offers two approaches to routing: The route table, which is a collection of routes that can be used to match incoming requests to controller actions.
Routing is a pattern matching system. Routing maps an incoming request (from the browser) to particular resources (controller & action method). This means routing provides the functionality to define a URL pattern that will handle the request. That is how the application matches a URI to an action.
You can use:
/Summer{*Data}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With