1

I am building a ASP.NET MVC application. In the RouteConfig.cs I am adding MapRoutes as follows:

var appModel = new AppModel();
var apps = appModel.GetAppNames();
foreach (var appName in apps)
{
    routes.MapRoute(
        name: "application" + appName,
        url: appName + "/{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );
}

When I go to page, for example http://localhost/appName1/Dashboard I have a link on my view that points to http://localhost/appName1/Home/About.

After that, when I go to another page - http://localhost/appName2/Dashboard, my link on my view still points to http://localhost/appName1/Home/About(and it should be http://localhost/appName2/Home/About). I am building the link with <a href='@Url.Action("About", "Home")'>about</a>. How to solve this?

kiriz
  • 655
  • 1
  • 7
  • 24

0 Answers0