Direct access to static pages in Asp.net MVC

Source: Internet
Author: User

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.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.