Pass IP address
-
I need to pass the IP address to app.config file that is created after installing the project.I got to add the web reference to run my service. Web reference would be .. http://202.79.41.240/Setup12/Service.asmx. Now I need to change the IP address that gets stored in app.config file. Thanx in advance.
-
I need to pass the IP address to app.config file that is created after installing the project.I got to add the web reference to run my service. Web reference would be .. http://202.79.41.240/Setup12/Service.asmx. Now I need to change the IP address that gets stored in app.config file. Thanx in advance.
XmlDocument xDoc = new XmlDocument(); xDoc.Load(@"YOURPATH\App.config"); if (xDoc.DocumentElement.SelectSingleNode("appSettings/add").Attributes.GetNamedItem("key").InnerText == "IP") { xDoc.DocumentElement.SelectSingleNode("appSettings/add").Attributes.GetNamedItem("value").InnerText = "genericIP"; xDoc.Save(@"YOURPATH\App.config"); }
But I am not sure how safe it is to handle you app config file in dynamicallySathy