Reputation: 1365
I have an ASP.NET MVC web application with the following routing system:
localhost:20119
And I want to modify it so that there is one more subroute/directory that "contains" all of the routes, such as:
localhost:20119
AppName
So instead of going to the following URL:
Users will instead go to
I am using:
and I believe MVC 4:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
Upvotes: 0
Views: 65
Reputation: 56869
If you want to bind the routing scheme to a physical directory location, there is an open source project that does just that called MvcCodeRouting (available on NuGet). There is nothing built into MVC that correlates routes with a physical directory location, but MVC can be extended to do it as in that project.
Upvotes: 0
Reputation: 406
You should just be able to add another layer to the routes in RouteConfig.cs. For example, you could do something like:
routes.MapRoute(
name: "Default",
url: "AppName/{controller}/{action}",
defaults: new { controller = "Home", action = "Index" }
);
Upvotes: 2