How can I retrieve the url of a web link added to a C # project?

Let's say I add a web link to a project), I would create it like this:

MyWebService.MyClass myClass = new MyWebServive.MyClass();

      

Is there anyway to get the url of that web service other than checking the config file like:

myClass.getURL();

      

at runtime? Does anyone have any idea?

+2


source to share


1 answer


The web reference classes get the HttpWebClientProtocol , which has a Url property. Therefore, you can simply use:



var url = myClass.Url;

      

+3


source







All Articles