1

Since I cannot use asp.net core web application, I am trying to recreate the template for Angular that is provided with the latest Visual Studio 2017.

enter image description here

I managed to make almost everything working the same way but I do not know what to replace the routes.MapSpaFallbackRoute with as I cannot find anything on google. It is responsible for all the routing. Without it the routing works only partially - the url changes, but if I refresh a browser while it is on any route, it fails with an error Server Error in '/' Application. The resource cannot be found. Do I have to blindly try to copy huge chunks of code from the Microsoft libraries to make it work or are there better ways to solve this problem?

Andrius Naruševičius
  • 8,348
  • 7
  • 49
  • 78
  • This is a server issue. You need to tell your server to redirect all requests it doesn't recognize to "index.html". Check out the answers [here](https://stackoverflow.com/q/31415052/1876949), some might apply to your environment. If not, search how to handle redirects for your server. – Sasxa Jan 26 '18 at 16:28
  • Because you use ASP.NET the chances are high you are using IIS. The best way to solve this is by using UrlRewriting. Check this [SO answer](https://stackoverflow.com/questions/27414235/iis-url-rewrite-rule-for-angular-spa-webapi) for an example – ErazerBrecht Jan 26 '18 at 20:06

0 Answers0