Superher0

I wrote a Windows app in .net 2.0 VS2005 that uses a webservice to communicate with the database server.

I added the reference to the webservice at design time using Project >> Add web reference...

Right now it's configured to connect on one of the IP addresses, but sometimes, when that connection goes down, I switch to another diginet provider (which obviously gives me a different IP address) - I would like users to be able to change the address to the webservice in my application.

Right now I tell them to edit this line in my appname.exe.config file:

<setting name="MyApplication_bsxml_Service" serializeAs="String">
<value>http://196.xxx.xxx.xxx/bssqlservice/service.asmx</value>

They change the IP address (the 196.xxx part) to the other address and then the app works, but I want a nicer approach to this. Like a drop-down at login where they can select which server they want to connect to.

How do I change the address



Re: Visual Basic Language Change Address of Web Service Server

stivo

Code Snippet

'Code in your your service...

Public Sub New()

MyBase.New

'for example

Dim urlSetting As String = System.Configuration.ConfigurationSettings.AppSettings("url.server")

Me.Url = urlSetting

End If

End Sub

Change the URL property in the constructor (New).

Steve





Re: Visual Basic Language Change Address of Web Service Server

Superher0

Steve, thanks for the reply - where exactly should I put this code



Re: Visual Basic Language Change Address of Web Service Server

stivo

Click with the right button on your service and choose "View Code" (if I remember well).

You should then see the code for your service and then you can modifiy the constructor (Method Sub New)

Steve