0
我想創建MVC 4 Multitenand Application。我的問題是如何在路由中設置基礎URL。設置Dynamic Base Url在多租戶MVC網站中路由
這裏是我的路線:
routes.MapRoute(
name: "Default",
url: "{portal}",
defaults: new { controller = "Home", action = "Index" }
);
routes.MapRoute(
"GameRating",
"{portal}/games/{name}/rates",
new { controller = "Game", action = "Rates" }
);
routes.MapRoute(
"GamePlaysCount",
"{portal}/games/{name}/play",
new { controller = "Game", action = "Play" }
);
我只是想設置{}門戶每租戶值在Global.asax的同時,應用程序啓動。 我通過請求頭標識了租戶,並且在我只想爲我的路由設置默認門戶值之後。我在控制器中過濾了門戶網站信息,因此我不需要更改控制器網址。我只生成門戶值的動態路由URL。
我找到了這些解決方案,但我沒有整合所有東西。
- Determine which portal to route to in a multi-tenant MVC website
- Is it possible to make an ASP.NET MVC route based on a subdomain?
- Setup a route {tenant}/{controller}/{action}/{id} with ASP.NET MVC?
什麼是你的建議嗎?
謝謝...