Modify server configuration Let asp.net file suffix name _win server

Source: Internet
Author: User
Tags one more line
Some sites for a variety of reasons, in IIS modified the default suffix of dynamic pages, the ASP era, someone on the server to modify the configuration, the HTML suffix file as an ASP file to resolve: that is, ASP programs (. asp) can be saved as a. htm suffix file on the server Web directory, and the server as an ASP program to interpret processing, generate results. In this way, the visitors, also think that the site is full of HTML pages, and often updated it (feel no need to do it?) Wrong, at least one of the benefits: Search engine is a priority to include HTML page Oh, so the site will be very easy to be found in search engine search.

It is easy to modify the suffix on the server to resolve ASP files, which can be modified in the IIS Service Manager-> site Properties-> The home directory-> configuration-> application mappings. If you have the experience of configuring a server to support PHP, then it's better to know what's going on.

But for ASP.net, the same way, to modify the application mapping, still did not get the expected results, what the contents of the file, what is returned is what content, rather than as a asp.net program to deal with.

In fact the main is a little bit worse, that is not in the Web.config file or C:\windows\microsoft.net\frameworl\v1.1.4322\config\ Machine.config (the path under WINDOWS2003, slightly different operating system paths), the HTTP handler for the file with the specific suffix configured (assuming we want to add a mapping to treat the. aspx page with a suffix of. aaa). ):

First stop Internet Information Services in IIS Service Manager (no way to save changes), and then open C:\windows\microsoft.net\frameworl\v1.1.4322\config\ with Notepad Machine.config, look for "*.aspx" to find this line:

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

The parsing of the. aspx file is configured so that, in the same way, we just add one more line and change the *.aspx to *.AAA:

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

Save your changes, and then start Internet Information Services, you can modify any ASPX file to a. aaa file.

If you do not want to modify the Machine.config file, you can also modify the Web site Web.config file implementation, the same method, under the <configuration><system.web> node to add the following configuration can be:

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

Finally, if it is IIS6 (that is, Windows2003 's own IIS), you also have to-> the HTTP header-> MIME type in the site properties of IIS A. AAA MIME type is added, otherwise a. AAA request will be first intercepted by IIS 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.