BenArticleI am very happy to take my own learning notes on the Asp.net MVC Framework. If you have any help, please correct me!
Recently I have been studying the Asp.net MVC framework. I declare that I am currently at the cainiao level. I am very curious about a problem. What if I access a static page directly?
In this case, I started my experiment in vsand wrote an index.html page. I added the final index.html file to the Views folder, and I directly encountered an error,
As follows:
"/" Application Program Server error.
The resource cannot be found.
Note: HTTP 404. The resource you are looking for (or one of its Dependencies) may have been removed, its name has been changed, or it is temporarily unavailable. Check the following URL and make sure it is correctly spelled.
Request URL: /Views/index.html
Version:Microsoft. NET Framework Version: 2.0.50727.3603; ASP. NET version: 2.0.50727.3053
I moved index.html to the root directory for browsing, and then moved it to another folder, such as controllers and models.
I searched the internet,
Default routetable. routes. routeexistingfiles = false;
In this way, you can directly browse existing files without routing.
When routetable. routes. routeexistingfiles = true, it must be routed.