i have two controllers with the same name in different sub folder
My Controllers looks like
- Controllers
- api
- UserController
- help
- UserController
- api
I want to access my first controller when the user requests http://mysite/api/User/Index
and access my second controller when the user requests http://mysite/help/User/Index
how to configure routing in Global.asax and how the views folders will look like?
will it look like?
- Views
- User
- api
- Index
- help
- Index
- api
- User
Thanks and Regards.
You could use namespace constraints:
As far as having sub-folders for your Views is concerned, this is not supported out of the box. You will have to write a custom view engine for this to work.
By the way have you considered using Areas? They seem like better fit for your scenario. So you would define 2 areas:
helpandapiand have the UserController defined in both.