Recently, when I was dealing with the agent server login process, I encountered a problem: I don't know whether to use defaultnetworkcredentials or defacrecredentials.
By referring to this blog:
The two return objects are different:
- Icrendentials defaultcredentials
- Networkcredential defaultnetworkcredentials
Networkcredential implements icrendentials. What is even more depressing is that in the msdn document, their descriptions are almost the same.
For defaultcredentialsIcredentialsInstance returnedDefaultcredentialsCannot be used to view the user name, password, or domain of the current security context. ", that is,IcredentialsThe user logon information cannot be viewed. Networkcredential is a new type introduced in. NET 2.0. It can be obtained through defaultnetworkcredentials. Theoretically, you can read the username and encrypted password string.
For more information, see:
Http://stackoverflow.com/questions/1058636/using-defaultcredentials-and-defaultnetworkcredentials