Options

Pass web service access key to web service from asp.net

rushabh149rushabh149 Member Posts: 15
edited 2014-09-26 in NAV Three Tier
How can we pass web service access key from asp.net. With windows authentication we normally use UseDefaultCredentials = true; But can not find any article or link for using NAVUserPassword or ACS authentication for web services.

Thanks.

Answers

  • Options
    rushabh149rushabh149 Member Posts: 15
    Somehow I was confused with navuserpassword and though network credentials won't work as it is with domain. But actually it works:

    System.Net.CredentialCache myCredentials = new System.Net.CredentialCache();
    NetworkCredential netCred = new NetworkCredential("userid", "webserviceaccesskey");
    myCredentials.Add(new Uri(NavWebService.Url), "Basic", netCred);
    NavWebService.Credentials = myCredentials;
Sign In or Register to comment.