private void button1_Click(object sender, EventArgs e) { using (localhost.HelloIndigoServiceClient proxy = new localhost.HelloIndigoServiceClient()) { proxy.ClientCredentials.UserName.UserName = this.txtUsername.Text; proxy.ClientCredentials.UserName.Password = this.txtPassword.Text; string s = proxy.HelloIndigo(); MessageBox.Show(s); } }
private void button2_Click(object sender, EventArgs e) { BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential); binding.MaxBufferSize = 100000; binding.MaxReceivedMessageSize = 100000; binding.ReaderQuotas.MaxArrayLength = 100000; binding.ReaderQuotas.MaxStringContentLength = 100000; EndpointAddress address = new EndpointAddress("https://localhost/BasicHttpBinding_Secure_WebHost/Service.svc"); using (localhost.HelloIndigoServiceClient proxy = new localhost.HelloIndigoServiceClient(binding, address)) { proxy.ClientCredentials.UserName.UserName = this.txtUsername.Text; proxy.ClientCredentials.UserName.Password = this.txtPassword.Text; string s = proxy.HelloIndigo(); MessageBox.Show(s); } }