Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
138 views
Welcome To Ask or Share your Answers For Others

1 Answer

I 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...