Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get value from applicationSettings?

I am trying to get value of service in my application from app.config. I have to send it to the application which shows the URL. A web service which I am consuming in this aplication also using it so can not move it to appSettings.

I want to get this value 'http://192.168.4.22:82/Service.asmx' through c# code.

<applicationSettings>
    <SDHSServer.Properties.Settings>
      <setting name="DOServer_WebReference1_Service" serializeAs="String">
        <value>http://192.168.4.22:82/Service.asmx</value>
      </setting>
    </SDHSServer.Properties.Settings>
  </applicationSettings>
like image 613
Azhar Avatar asked Feb 17 '12 14:02

Azhar


People also ask

How do I get to application settings?

From the Home screen, tap the Apps icon (in the QuickTap Bar) > the Apps tab (if necessary) > Settings .

How do I get AppSettings in C#?

To access these values, there is one static class named ConfigurationManager, which has one getter property named AppSettings. We can just pass the key inside the AppSettings and get the desired value from AppSettings section, as shown below. When we implement the code given above, we get the output, as shown below.

What is the use of Web config file?

A web. config file is a Windows file that lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web. config file in your root directory, it will affect your entire site (www.coolexample.com).

How does app config work?

App. Config is an XML file that is used as a configuration file for your application. In other words, you store inside it any setting that you may want to change without having to change code (and recompiling). It is often used to store connection strings.


1 Answers

Not sure i get the question,

string s = SDHSServer.Properties.Settings.DOServer_WebReference1_Service;

will get you it

like image 124
dice Avatar answered Oct 05 '22 10:10

dice