Guest User

Untitled

a guest
Aug 10th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. Web Service 401: Unauthorized Error
  2. // Webservice
  3. IdentityService ws = new IdentityService();
  4.  
  5. // Test Static Credentials
  6. string username = "twfnf";
  7. string password = "testme99";
  8. string domain = "testapps1";
  9.  
  10. NetworkCredential credentials = new NetworkCredential(username, password, domain);
  11.  
  12. CredentialCache credCache = new CredentialCache();
  13. credCache.Add(new Uri(ws.Url), "Basic", credentials);
  14.  
  15. ws.Credentials = credCache;
  16. ws.PreAuthenticate = true;
  17. ws.AuthenticateUser();
  18.  
  19. CredentialCache credCache = new CredentialCache();
  20. credCache.Add(new Uri(ws.Url), "Basic", credentials);
  21.  
  22. // Webservice
  23. IdentityService ws = new IdentityService();
  24.  
  25. // Test Static Credentials
  26. string username = "twfnf";
  27. string password = "testme99";
  28. string domain = "testapps1";
  29.  
  30. NetworkCredential credentials = new NetworkCredential(username, password, domain);
  31.  
  32. ws.Credentials = credentials;
  33. ws.PreAuthenticate = true;
  34. ws.AuthenticateUser();
Add Comment
Please, Sign In to add comment