Search code examples
c#.netapp-configwindowsweb-reference

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>

Solution

  • Not sure i get the question,

    string s = SDHSServer.Properties.Settings.DOServer_WebReference1_Service;
    

    will get you it