Yes, you can change the URL referenced at runtime.
If it is in the .config file, IIS will be , your application should detect a change in the .config file and load the new value. If not, you will have to restart the client. Perhaps you can stop and start the website in IIS.
In addition, you can definitely WRITE your code to read from a .config file.
var myWS = new MyWebService(); myWS.Url = WebServiceURL; myWS.SomeMethod(); private static string WebServiceURL { get { return ConfigurationManager.AppSettings["MyWebServiceURL"].ToString(); } }
Meanwhile, in your .config file, you have:
<appSettings> <add key="MyWebServiceURL" value="http://blah/foo/bar.asmx" /> </appSettings>
p.campbell
source share