Which one am I supposed to use when I need to supply a credential to a proxy (local or in Network)?
What’s the exact difference between these two?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
They are exactly the same thing, which you can confirm for yourself using a disassembler like Reflector. The only difference is that
DefaultNetworkCredentialsreturns aNetworkCredentialsobject and andDefaultCredentialscasts it toICredentials. So you have access to more information with a NetworkCredentials object, but which of those you use supply to an object requiring an ICredentials instance makes no difference, since it’s the same object instance:object.ReferenceEquals(CredentialCache.DefaultCredentials, CredentialCache.DefaultNetworkCredentials)returnstrue.