Export (0) Print
Expand All

ICredentialPolicy.ShouldSendCredential Method

Returns a Boolean that indicates whether the client's credentials are sent with a resource request made using an instance of the WebRequest class.

Namespace:  System.Net
Assembly:  System (in System.dll)

abstract ShouldSendCredential : 
        challengeUri:Uri * 
        request:WebRequest * 
        credential:NetworkCredential * 
        authenticationModule:IAuthenticationModule -> bool

Parameters

challengeUri
Type: System.Uri

The Uri that will receive the request. For more information, see the Remarks section.

request
Type: System.Net.WebRequest

The WebRequest that represents the resource being requested.

credential
Type: System.Net.NetworkCredential

The NetworkCredential that will be sent with the request if this method returns true.

authenticationModule
Type: System.Net.IAuthenticationModule

The IAuthenticationModule that will conduct the authentication, if authentication is required.

Return Value

Type: System.Boolean
true if the credentials are sent with the request; otherwise, false.

After an ICredentialPolicy policy has been specified by setting the AuthenticationManager.CredentialPolicy property, the IAuthenticationModule that handles authentication for a WebRequest invokes the ShouldSendCredential method before performing the authentication. If this method returns false, authentication is not performed.

When the original request has been redirected or proxy authentication is required, the resource identified by challengeUri can be different from the requested resource that is specified in WebRequest.RequestUri. In the case of redirection, challengeUri contains the actual destination Uri. If proxy authentication is required, challengeUri contains the address of the proxy server that requires client authentication.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft