The difference between using. config and. xml files in iis/asp.net is. config. xml

Source: Internet
Author: User

The difference between using. config and. xml files in iis/asp.net is. config. xml

 

Some users in the project use a file suffixed with. xml as the configuration file, and some sensitive information in the configuration file is recorded, such as the interface address, Token, and even the database connection string.

I have never thought about why Microsoft uses the. config extension as web. config. Is it just for the sake of being intuitive? Is it a configuration file? As we all know,. config is actually part of. xml and is a subset. In theory, xxx. xml can also be used. As a result, many people habitually use many configuration files with the suffix of. xml. If xml is used on the website, you can browse the content of the. xml file without restriction. If your. xml file is configured with sensitive information, a ray is buried.

 

Solution:

1. Configure request filtering in iis. In fact, the. config suffix is used because iis adds request filtering by default and does not need to be configured by itself. This is also the main reason, and the secondary reason is that. config intuitively knows the configuration file.

This is the default. config configuration.

Add a hidden segment "configs", set the entire directory to inaccessible, and try the effect.

Effect after Configuration:

 

 

2. If possible, change the. xml configuration file to. config in the website project.

But it is also limited to configuration files.If it is just a common xml file, there is no need to use the suffix of. config. Different services use different methods.

Using. config as the configuration file also reduces the headache of website maintenance personnel. If we say that our website has been violent one day, we may not be able to find the problem for a long time.

 

Many may ignore this detail. In particular, from desktop developers to develop website projects ..

 

The content of this article may not be completely correct. If you have any mistakes, please tell us to avoid mistakes. Thank you.

 

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.