C # specify the config file to read information

Source: Internet
Author: User

Generally, the configuration file is web. config or app. config. If we have created a config file and configured some information, then we should specify the config file to read the relevant information. Then I found a method, the execonfigurationfilemap class is available. To use this class, you must first reference system. configuration, create a new execonfigurationfilemap object, set the config path you created to the execonfigfilename attribute, and then use this method to configure Config = configurationmanager. openmappedexeconfiguration (ECF, configurationuserlevel. none); you can specify to read the configuration information in the newly created config file. There is a small problem here, that is, the config path, I can read the config when using the absolute path, but I cannot use the relative path, during debugging, I found that his reading path is under the System32 folder on drive C. Can you tell me why?

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.