views:

62

answers:

1

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.

A: 

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);

            }
Shoaib Shaikh
its from a console app but same will work in SL app as well.
Shoaib Shaikh