Asp.net reads the Web. config file

Source: Internet
Author: User
In Asp.net, when you need to read the configuration file, it is generally used to read the database connection string. This is simple and practical configurationmanager. connectionstrings ["ompdbconn"]. connectionstring is enough, but reading a node like authentication is a little troublesome.

When using the SDK to introduce web configuration files Note that when calling this openmachineconfiguration () function, you must note that if you enter a string. empty: reads the default configuration file of Asp.net, which is displayed on my machine: C: \ WINDOWS \ Microsoft. net \ framework \ v2.0.50727 \ config \ Web. config; if "/" is entered, the configuration file of the wwwroot root directory is read, which is generally: C: \ Inetpub \ wwwroot \ Web. config. that is to say, if you want to read a non-followed directory Program, You need to pay special attention to the path filled in. Read this web application to use "~ ", Add the corresponding folder name suffix when reading the configuration file of the corresponding child node.
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.