Gets or sets authentication information for the request.
Assembly: System (in System.dll)
The 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.property contains authentication information to identify the maker of the request. The property can be either a
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.
Available since 4.5
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 7.0
Available since 8.1