Gets or sets authentication information for the request.
Assemblies: System.Net.Requests (in System.Net.Requests.dll)
System (in System.dll)
abstract Credentials : ICredentials with get, set override Credentials : ICredentials with get, set
The property contains authentication information to identify the maker of the request. The property can be either a NetworkCredential, in which case the user, password, and domain information contained in the NetworkCredential object is used to authenticate the request, or it can be a CredentialCache, in which case the Uniform Resource Identifier (URI) of the request is used to determine the user, password, and domain information to use to authenticate the request.
In most client scenarios, you should use the DefaultCredentials property, which contains the credentials of the currently logged on user. To do this, set the UseDefaultCredentials property to true instead of setting this property.
If the HttpWebRequest class is being used in a middle-tier application, such as an ASP.NET application, the credentials in the DefaultCredentials property belong to the account running the ASP page (the server-side credentials). Typically, you would set this property to the credentials of the client on whose behalf the request is made.
The NTLM authentication scheme cannot be used to impersonate another user. Kerberos must be specially configured to support impersonation.
To restrict HttpWebRequest to one or more authentication methods, use the CredentialCache class and bind your credentials to one or more authentication schemes
Supported authentication schemes include Digest, Negotiate, Kerberos, NTLM, and Basic.