Web Service Security RRS feed

  • Question

  • User-221825409 posted

    I have a web service called directory.svc. I am going to inplement httpmodule from greg rassoc (http://www.rassoc.com/gregr/weblog/2002/06/26/web-services-security-http-basic-authentication-without-active-directory/) as my security approach. So now when I go to www.mydomain.com/services/directory.svc it will prompt me with username and password. But my question is, how can I call
    this service from my other web application? How can I pass the user credentials, because the attribute is not being exposed in WSDL file.<br>
    Thanks in advance.
    Friday, June 13, 2014 8:46 PM


  • User697462465 posted

    Hi saasdesigner,

    WCF service with username password authentication have two ways to use it:

    1. When you add the reference in your project, it will ask you input the username and password, if you input the correct username and password, you don't need to input it again in the course of use.

    2. You can also use the following code to pass the authentication:

    var result = new CustomerDeskOperationsClient(binding, endPoint);
    result.ClientCredentials.UserName.UserName = "username";
    result.ClientCredentials.UserName.Password = "password";

    More information please refer to:

    Hope it helps.

    Best Regards,
    Terry Guo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 15, 2014 10:51 PM