Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I define a catch-all route for an ASP.NET MVC site?

I have a news site with articles tagged in categories.

My Controller is called "Category" and this URL:

http://mysite.com/Category/Sport

passes Sport to action Index in controller Category.

I want to allow the following URLs:

http://mysite.com/Sport/Hockey
http://mysite.com/Sport/Football
http://mysite.com/Science/Evolution

Which passes all category information to action Index in controller Category.

How do I create a catch-all route that handles all these and shuttles them to category?

like image 977
WayneDV Avatar asked Oct 20 '08 15:10

WayneDV


1 Answers

There's a pretty good response to my question along these lines here.

like image 170
jmcd Avatar answered Sep 25 '22 02:09

jmcd