Solved

C# Read app.config

Posted on 2011-02-19
4
979 Views
Last Modified: 2013-12-17
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
Comment
Question by:jtran007
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Mamtha1982
ID: 34935962
Reading:
string timeOut=YourNamespace.Settings.Default.Timeout;

Writing:
YourNamespace.Settings.Default.Timeout=timeOut;
YourNamespace.Settings.Default.Save();
0
 
LVL 12

Accepted Solution

by:
Mamtha1982 earned 500 total points
ID: 34935964
Reading:
string timeOut=UpdatePanel.Settings.Default.Timeout;

Writing:
UpdatePanel.Settings.Default.Timeout=timeOut;
UpdatePanel.Settings.Default.Save();
0
 

Author Comment

by:jtran007
ID: 34937685
Hi guru,

Thanks. However your code shoul be:

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

Regards,
JT

0
 

Author Closing Comment

by:jtran007
ID: 34937687
Thanks,
JT
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now