Επεξεργασία

Κοινή χρήση μέσω


ICredentialPolicy.ShouldSendCredential Method

Definition

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

public:
 bool ShouldSendCredential(Uri ^ challengeUri, System::Net::WebRequest ^ request, System::Net::NetworkCredential ^ credential, System::Net::IAuthenticationModule ^ authenticationModule);
public bool ShouldSendCredential (Uri challengeUri, System.Net.WebRequest request, System.Net.NetworkCredential credential, System.Net.IAuthenticationModule authenticationModule);
abstract member ShouldSendCredential : Uri * System.Net.WebRequest * System.Net.NetworkCredential * System.Net.IAuthenticationModule -> bool
Public Function ShouldSendCredential (challengeUri As Uri, request As WebRequest, credential As NetworkCredential, authenticationModule As IAuthenticationModule) As Boolean

Parameters

challengeUri
Uri

The Uri that will receive the request.

request
WebRequest

The WebRequest that represents the resource being requested.

credential
NetworkCredential

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

authenticationModule
IAuthenticationModule

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

Returns

true if the credentials are sent with the request; otherwise, false.

Remarks

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.

Applies to