Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1014
  • Last Modified:

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
0
jtran007
Asked:
jtran007
  • 2
  • 2
1 Solution
 
Praveen KumarArchitectCommented:
Reading:
string timeOut=YourNamespace.Settings.Default.Timeout;

Writing:
YourNamespace.Settings.Default.Timeout=timeOut;
YourNamespace.Settings.Default.Save();
0
 
Praveen KumarArchitectCommented:
Reading:
string timeOut=UpdatePanel.Settings.Default.Timeout;

Writing:
UpdatePanel.Settings.Default.Timeout=timeOut;
UpdatePanel.Settings.Default.Save();
0
 
jtran007Author Commented:
Hi guru,

Thanks. However your code shoul be:

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

Regards,
JT

0
 
jtran007Author Commented:
Thanks,
JT
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now