What needs to be changed to change the url of a web service in C #?

I have one problem and a while ago I added a Webservice proxy class to my application by copying all the generated code (copy the .cs content text).

And it worked!

But now I need to change the url used by this web service proxy class and I'm not sure what and where can be changed in the code.

I would appreciate it if you could give me a clue to help me find a suitable location so that I can update the url of the web service.

+2


a source to share


3 answers


You have to change the url using web.config. If you go to the properties of the added link on the web, you will see a property named URL Behavior. Set to "dynamic" and provide a URL. This will make an entry in the web.config file and whenever you change this entry, this url will be executed. More details here .



+2


a source


If it is a generated asmx webservice proxy, the proxy class has a property - URL

.
You can set the property URL

where you create the proxy object, or you can hard code it in the proxy class.
By default, the generated proxy class has code in the constructor to set the property URL

from the application settings.



+4


a source


Use the URL property

0


a source







All Articles