views:

88

answers:

1

I have a topLevel folder with a subFolder holding ControllerName. When I enter:

http://localhost/FolderName/FolderName/ControllerName

how do i tell mvc to account for the folder depth?

thx

+2  A: 

You'll need to configure your routes in Global.asax.cs. It doesn't actually matter physically where your controller is stored, but it should probably be in the /Controllers folder in your project.

Something like this in the RegisterRoutes method:

routes.MapRoute(
    "RouteName", // Route name
    "FolderName/FolderName/{controller}", // URL with parameters
    new { controller = "ControllerName", action = "Index", url = "" } // Parameter defaults
);

Put it before the other routes as it is quite specific.

wows