views:

21

answers:

1

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

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

Is there anyway to get the URL of this web service aside from checking the config file, e.g:

myClass.getURL();

at runtime? Does anybody have some ideas?

+2  A: 

Web reference classes derive from HttpWebClientProtocol, which has a Url property. So you can simply use:

var url = myClass.Url;
Matt Hamilton
Thanks, I was looking at the wrong class! That works just fine.
Mr. Smith