How to get value from applicationSettings?

Azhar picture Azhar · Feb 17, 2012 · Viewed 33.4k times · Source

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>

Answer

dice picture dice · Feb 17, 2012

Not sure i get the question,

string s = SDHSServer.Properties.Settings.DOServer_WebReference1_Service;

will get you it