I came up with this solution that works. The button is defined in the .aspx file:
<asp:button id="butValve0_ON" runat="server" onclick="butValve0_ON_Click" text="Valve 0 ON" width="105px" height="25px" xmlns:asp="#unknown" />
This solution causes the whole page to be refreshed, but it always works. One should add some error and no-response checking to this solution. A TextBox is updated when the WebService responds with "OK".
<pre> protected void butValve0_ON_Click(object sender, EventArgs e)
{
//Send the URL to remote server, wait for and capture response
Uri myUri = new Uri("http://agratek.dyndns.org:8080/webservice?Op=Actuate&NodeID=2&PortID=0&Value=ON");
System.Net.WebClient myWebClient = new System.Net.WebClient();
Stream myStream = myWebClient.OpenRead(myUri);
StreamReader sr = new StreamReader(myStream);
string returnData = sr.ReadToEnd(); // check for OK
tbValve0State.Text = returnData;
myStream.Close();
if ( returnData.Contains("OK") )
{
tbValve0State.Text = "ON";
tbValve0State.BackColor = System.Drawing.Color.LightGreen;
}
}