Link to home
Start Free TrialLog in
Avatar of jtran007
jtran007

asked on

C# Read app.config

Hi,

I have below app.config, how can I retrieve data (timeout, booster, ..)from this file?

 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
        <section name="UpdatePanel.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
</configSections>
<startup><supportedRuntime version="v2.0.50727"/></startup>
    <applicationSettings>
        <UpdatePanel.Properties.Settings>
            <setting name="TimeOut" serializeAs="String">
                <value>3000</value>
            </setting>
            <setting name="Bridge" serializeAs="String">
                <value>bridge.csm</value>
            </setting>
            <setting name="Booster" serializeAs="String">
                <value>booster.csm</value>
            </setting>
            <setting name="Firmware" serializeAs="String">
                <value>firmware.csm</value>
            </setting>
        </UpdatePanel.Properties.Settings>
    </applicationSettings>
</configuration>

Thanks,
JT
Avatar of Praveen Kumar
Praveen Kumar
Flag of India image

Reading:
string timeOut=YourNamespace.Settings.Default.Timeout;

Writing:
YourNamespace.Settings.Default.Timeout=timeOut;
YourNamespace.Settings.Default.Save();
ASKER CERTIFIED SOLUTION
Avatar of Praveen Kumar
Praveen Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jtran007
jtran007

ASKER

Hi guru,

Thanks. However your code shoul be:

string timeOut=YourNamespace.Properties.Settings.Default.Timeout;

Regards,
JT

Thanks,
JT