When I am adding the "Web Reference" we are giving the address to the asmx page to visual studio.
How Can I set this at run time?
See Question&Answers more detail:osWhen I am adding the "Web Reference" we are giving the address to the asmx page to visual studio.
How Can I set this at run time?
See Question&Answers more detail:osI would have upvoted one of the other answers - they're almost correct.
using (YourService service = new YourService())
{
service.Url = "http://some.other.url/";
// Now you're ready to call your service method
service.SomeUsefulMethod();
}
If a using block is not used, and an exception is thrown, then resources like network connections can be leaked.