0

Is there any way to keep the particular section of config file in another file and reference it?

 <configuration> 
    <appSettings>
        <add key="LogConfigXMLPath" value="D:\IIS_CODE\virtualworkspace\LogConfig.xml"/>
        <add key="ErrorLoggerName" value="ErrorLogger"/>
        <add key="CouchDBHost" value="ctsintbmvstcdb"/>
        <add key="CouchDBPort" value="5984"/>
        <add key="CouchDBBaseDatabase" value="virtualworkplace"/>
    </appSettings>
    </configuration>

Whether is there any possible way to reference this kind of code?

1 Answer 1

1

If you're asking if you can reference the appSettings section from an external file then yes you can.

External.config file:

<appSettings>
    <add key="LogConfigXMLPath" value="D:\IIS_CODE\virtualworkspace\LogConfig.xml"/>
    <add key="ErrorLoggerName" value="ErrorLogger"/>
    <add key="CouchDBHost" value="ctsintbmvstcdb"/>
    <add key="CouchDBPort" value="5984"/>
    <add key="CouchDBBaseDatabase" value="virtualworkplace"/>
</appSettings>

Then, in your your app.config or web.config:

<?xml version="1.0"?>
<configuration>
    <appSettings file="C:\PathToYourExternalConfigFile\External.config">
        <add key="SomeAdditionalKey" value="Value1" />
    </appSettings>
</configuration>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.