Modify the server configuration to let the asp.net file suffix name as you wish

  • 2020-05-06 12:04:29
  • OfStack

Some website for a variety of reasons, modify the dynamic pages in the IIS default suffix, asp times someone modify configuration on the server, the html suffix as asp file to parse: that is to say, asp program (suffix for. asp) can be saved as a. htm suffix file into the WEB directory on the server, the server so as asp programs to explain the process, generate results. This way, visitors will think that the site is full of html pages and updated frequently. Wrong, at least one benefit: search engines give priority to the html page, so that the site will be easily searched in the search engine
Changing the suffix for parsing asp files on the server is easy in IIS service manager -> Site properties -> Home directory - > Configuration - > Just make the changes in the application map. If you have experience configuring a server to support PHP, you'll know better.

This is not the case with asp.net. In the same way, when you modify the application map, you still don't get the desired result, and you return whatever the file contains, instead of processing it as an asp.net program.

HTTP processor, configuration step (assuming we want to add a map, Treat files with the.aaa suffix as if they were.aspx pages. :

First stop the internet information service in IIS service manager (no way to save the changes), then use notepad to open C:\windows\ microsoft.net \frameworl\ v1.1.4322 \config\ machine.config, look for "*.aspx ", can find this line:

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

This is how the parsing of the.aspx file is configured, and in the same way, we just need to add one more line and change the *.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 the internet information service to change any aspx file to one with the suffix.aaa.

If you do not want to modify the machine.config file, you can also modify the web.config file of the website in a similar way in < configuration > < system.web > Add the following configuration under the 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 (windows2003 comes with IIS), it must be in the IIS site attribute -> Head - > HTTP Add an MIME type of.aaa to the MIME type, otherwise the request of.aaa will be intercepted by IIS first and cannot be displayed.

Related articles: