【发布时间】:2016-04-10 16:50:58
【问题描述】:
我正在将 ASP.Net 4.5 应用程序重写为 Angular2。当我尝试刷新 ng2-Route 时,浏览器会转到服务器并找不到 url。
这与question 中的问题相同。该解决方案仅适用于 ASP.Net 5。我在 Route.config 中尝试了以下内容:
routes.MapRoute(
name: "spa-fallback",
url: "{*url}",
defaults: new { controller = "Home", action = "Index" }
);
但这不起作用。有没有办法在 ASP.Net 4.5 中处理客户端 url?
【问题讨论】:
-
当然,您必须将路线与链接到答案的顺序相同才能使其正常工作 - 一条包罗万象的路线应该始终排在最后。
标签: asp.net-mvc-4 routing angular