Guest User

Untitled

a guest
Jul 30th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. maintaining credentials for wcf binding over the life of my app
  2. public class ProxyGenerator
  3. {
  4.  
  5. public string username;
  6. public SecureString password;
  7. public string endpoint;
  8.  
  9. private TestingService.ServiceClient _proxy = null;
  10.  
  11. public ProxyGenerator(string uname, SecureString pword)
  12. {
  13. username = uname;
  14. password = pword;
  15.  
  16. endpoint = "insert endpoint here"
  17.  
  18. }
  19.  
  20. public TestingService.ServiceClient GetProxy()
  21. {
  22. _proxy = new ServiceClient(endpoint);
  23. _proxy.ClientCredentials.UserName.UserName = username;
  24. _proxy.ClientCredentials.UserName.Password = password;
  25.  
  26. return _proxy;
  27. }
  28. }
Add Comment
Please, Sign In to add comment