1

I am rewriting a ASP.Net 4.5 application to Angular2. When I try to refresh a ng2-Route, the browser goes to the server and can not find the url.

It's the same problem like in this question. The solution there is only for ASP.Net 5. I have tried the following in my Route.config:

routes.MapRoute(
    name: "spa-fallback",
    url: "{*url}",
    defaults: new { controller = "Home", action = "Index" }
);

But that does not work. Is there a way to handle client-side urls in ASP.Net 4.5?

Community
  • 1
  • 1
Weissvonnix
  • 731
  • 7
  • 23
  • Of course, you do have to put the routes in the same order as the linked to answer in order for it to work - a catchall route should always go last. – NightOwl888 Apr 11 '16 at 00:31

1 Answers1

0

The above solution works, but only if I remove the defaultRoute (or maybe any other routes) in my Route.config

Weissvonnix
  • 731
  • 7
  • 23