Asp.Net (C#) MVC Routing - Trying avoid using the same controller in different places and think rout
- by sheefy
Hi Guys,
I'm currently building a site which has a bunch of main categories and in each category you can perform a search.
Basically, I want my addresses to work like this...
When the website loads (as in when someone goes to www.mySite.com) it will redirect them to the default category.
www.mySite.com/Category
Then when you search within a category, the results would come up in a page like the following.
www.mySite.com/Category/Search
I want to put everything in one controller and have one main view for the Category and one for the Search, I would then render these based on which category is currently being viewed.
Can this be done, maybe with routing? I don't want to have to create a different controller for each category as it's just duplicating a lot of the code.
Thanks in advance for your help.