【发布时间】:2014-10-03 14:46:22
【问题描述】:
我有一个 MVC 应用程序,但无法让路由为我的多租户应用程序工作。问题来了:
我的应用程序中有 2 种类型的页面,大多数要求租户名称在 url 中,但有些不需要。例如
这些都做(租户名称是这些例子是三星和苹果):
http://www.mytestapp.com/samsung/customers/add
http://www.mytestapp.com/apple/customers/add
这些不要:
http://www.mytestapp.com/home/register/
http://www.mytestapp.com/home/aboutus/
我需要哪些路线才能使其正常工作?我已经尝试过了,但它不适用于注册和关于我们的页面。
routes.MapRoute(
name: "TenantRoute",
url: "{tenantid}/{controller}/{action}/{id}",
defaults: new { tenantid = "tenantname", controller = "Home", action = "Index", id = UrlParameter.Optional }
);
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-4 routes