开发者

How to find out the Domain name

proxy.ClientCredentials.Windows.ClientCredential开发者_StackOverflow.UserName = "user";
proxy.ClientCredentials.Windows.ClientCredential.Password = "password";
proxy.ClientCredentials.Windows.ClientCredential.Domain = "my computer's name";

Hi!

How can I find out the Domain name? Is it my computer's name?

Thanks a lot!


Take a look at the DefaultNetworkCredentials property on the CredentialsCache class. It has the Domain property you're looking for.

And no, it will not be the computer name. It will either be the name of the Windows domain the current user belongs to, or the workgroup if you're not joined to a domain.


It depends on the server, you are passing credentials to be authenticated on the server. As such, several possible cases:

  • Server is in a domain DOMAIN, the credentials you pass should match a domain user. In that case, specify DOMAIN in the domain property.
  • Server is not in a domain, the client should provide credentials that match a user in the server realm (a local user of the server). In that case, put the server hostname in the Domain property.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜