0
votes

I have a WCF Web Service with a custom username/password validator.

How does one specify the username and password as the ClientCredentials properties when creating a service in Silverlight are read-only?

Thanks for any help.

1

1 Answers

1
votes

This is quite simple:

ServiceReference1.Service1Client client = new ConsoleApplication1.ServiceReference1.Service1Client();

            client.ClientCredentials.UserName.UserName = "User";
            client.ClientCredentials.UserName.Password = "p@ssword";

            try
            {
                Console.WriteLine(client.GetData(123));
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);

            }