Modify the server configuration so that the suffix of the asp.net file is as desired.

Source: Internet
Author: User

Some websites modify the default Suffix of dynamic pages in IIS for various reasons. In the asp era, some users modify the configuration on the server and parse the html suffix files as asp files: in other words, the aspprogram (.asp;can save a file with the suffix of .htm to the WEB directory on the server, and the server still treats it as an asp program to explain and generate results. In this way, visitors still think that the website is full of html pages and is updated frequently (Do you feel unnecessary? Wrong, at least one benefit: Search Engines give priority to html pages. In this way, websites can be easily searched by search engines)

It is easy to modify the suffix of asp file Resolution on the server. You can modify the Suffix in IIS Service Manager> site Properties> Home directory> Configuration> application ing. If you have experience in configuring servers to support PHP, you will be more clear about what is going on.

However, asp.net won't work. In the same way, after modifying the application ing, we still don't get the expected results. What is the content of the file and what is returned, instead of being processed as an asp.net program.

In fact, it is a little bit worse, that is, it is not on the web. config file or C: \ windows \ microsoft.net \ frameworl \ v1.1.4322 \ config \ machine. in config (the path under windows2003, different operating system paths are slightly different), configure the HTTP processing program for the file with a specific suffix. The configuration procedure (Suppose we want to add a ing and suffix it. aaa files are treated. aspx page .) :

Stop the internet information service in the IIS Service Manager (you cannot save the modification without stopping it), and use NotePad to Open C: \ windows \ microsoft.net \ frameworl \ v1.1.4322 \ config \ machine. config, find "*. aspx ", you can find this line:

The code for this article is as follows:
<Add verb = "*" path = "*. aspx" type = "System. Web. UI. PageHandlerFactory"/>

The parsing of the. aspx file is configured in this way. In the same way, we only need to add another line and change *. aspx to *. aaa:

The code for this article is as follows:
<Add verb = "*" path = "*. aaa" type = "System. Web. UI. PageHandlerFactory"/>

Save the changes and start internet Information Service. Then, you can change any aspx file to a file suffixed with. aaa.

If you do not want to modify the machine. config file, you can also modify the web. config file of the website. The method is similar. Add the following configuration under the <configuration> <system. web> node:

The code for this article is as follows:
<HttpHandlers>
<Add verb = "*" path = "*. aaa" type = "System. Web. UI. PageHandlerFactory"/>
</HttpHandlers>

Finally, if it is IIS6 (that is, IIS that comes with windows2003), you must add one in IIS Site Properties> HTTP header> MIME type. MIME Type of aaa, otherwise. aaa requests will be intercepted by IIS first and cannot be displayed.

Related Article

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.