Pinchy
Pinchy

Reputation: 1536

How to find out the Domain name

proxy.ClientCredentials.Windows.ClientCredential.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!

Upvotes: 1

Views: 336

Answers (2)

Johann Blais
Johann Blais

Reputation: 9469

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.

Upvotes: 1

Peter Lillevold
Peter Lillevold

Reputation: 33910

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.

Upvotes: 1

Related Questions