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.