Handle Client-Side Url in ASP.Net 4.5 MVC 4 Router

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?

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

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