protected void btnSayHello_Click(object sender, EventArgs e) { Sample.HelloClient proxy = new Sample.HelloClient(); Page.ClientScript.RegisterStartupScript( this.GetType(), "js", string.Format("alert('{0}')", proxy.SayHello(txtName.Text)), true); proxy.Close(); }