Export (0) Print
Expand All

ICredentialPolicy.ShouldSendCredential Method

Note: This method is new in the .NET Framework version 2.0.

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)

bool ShouldSendCredential (
	Uri challengeUri,
	WebRequest request,
	NetworkCredential credential,
	IAuthenticationModule authenticationModule
)
boolean ShouldSendCredential (
	Uri challengeUri, 
	WebRequest request, 
	NetworkCredential credential, 
	IAuthenticationModule authenticationModule
)
function ShouldSendCredential (
	challengeUri : Uri, 
	request : WebRequest, 
	credential : NetworkCredential, 
	authenticationModule : IAuthenticationModule
) : boolean

Parameters

challengeUri

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

request

The WebRequest that represents the resource being requested.

credential

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

authenticationModule

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

Return Value

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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft