简体   繁体   English

是否有必要设置NetworkCredential域?

[英]Is it necessary to set NetworkCredential domain?

Is it necessary to set networkCredential domain while accessing a web service? 是否有必要在访问Web服务时设置networkCredential域?

var service = new service1.SoapEx();
service.Credentials = new NetworkCredential("user", "password", "domain");

or i can do: 或者我可以这样做:

 var service = new service1.SoapEx();
 service.Credentials = new NetworkCredential("user", "password");

Thanks 谢谢

No, it's not necessary as the NetworkCredential class features a constructor just like your second example. 不,没有必要,因为NetworkCredential类具有与第二个示例类似的构造函数。 Keep in mind though that the password param only accepts SecureString, not String. 请记住,密码参数只接受SecureString,而不是String。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM