CredentialCache.Remove Méthode

Définition

Supprime du cache une instance de NetworkCredential.

Surcharges

Remove(Uri, String)

Supprime une instance de NetworkCredential du cache si elle est associée au préfixe URI (Uniform Resource Identifier) et au protocole d’authentification spécifiés.

Remove(String, Int32, String)

Supprime une instance de NetworkCredential du cache si elle est associée à l’hôte, au port et au protocole d’authentification spécifiés.

Remove(Uri, String)

Source:
CredentialCache.cs
Source:
CredentialCache.cs
Source:
CredentialCache.cs

Supprime une instance de NetworkCredential du cache si elle est associée au préfixe URI (Uniform Resource Identifier) et au protocole d’authentification spécifiés.

public:
 void Remove(Uri ^ uriPrefix, System::String ^ authType);
public void Remove (Uri uriPrefix, string authType);
public void Remove (Uri? uriPrefix, string? authType);
member this.Remove : Uri * string -> unit
Public Sub Remove (uriPrefix As Uri, authType As String)

Paramètres

uriPrefix
Uri

Uri qui spécifie le préfixe URI des ressources pour lesquelles les informations d’identification sont utilisées.

authType
String

Schéma d'authentification utilisé par l'hôte nommé dans uriPrefix.

Exemples

L’exemple de code suivant utilise cette méthode pour supprimer un NetworkCredential instance du cache.

// Create a webrequest with the specified url.
WebRequest^ myWebRequest = WebRequest::Create( url );
myWebRequest->Credentials = myCredentialCache;
Console::WriteLine( "\nLinked CredentialCache to your request." );
// Send the request and wait for response.
WebResponse^ myWebResponse = myWebRequest->GetResponse();

// Process response here.

Console::Write( "Response received successfully." );

// Call 'Remove' method to dispose credentials for current Uri as not required further.
myCredentialCache->Remove( myWebRequest->RequestUri, "Basic" );
Console::WriteLine( "\nYour credentials have now been removed from the program's CredentialCache" );
myWebResponse->Close();
// Create a webrequest with the specified url.
WebRequest myWebRequest = WebRequest.Create(url);
myWebRequest.Credentials = myCredentialCache;
Console.WriteLine("\nLinked CredentialCache to your request.");
// Send the request and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Process response here.

Console.Write("Response received successfully.");
// Call 'Remove' method to dispose credentials for current Uri as not required further.
myCredentialCache.Remove(myWebRequest.RequestUri,"Basic");
Console.WriteLine("\nYour credentials have now been removed from the program's CredentialCache");
myWebResponse.Close();
' Create a webrequest with the specified url .
Dim myWebRequest As WebRequest = WebRequest.Create(url)
myWebRequest.Credentials = myCredentialCache
Console.WriteLine(ControlChars.Cr + "Linked CredentialCache to your request.")
' Send the request and wait for response.
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()

'Process the response here

Console.Write("Response received successfully.")
'Call 'Remove' method to dispose credentials for current Uri as they would not be; 
'required in any of the future requests.
myCredentialCache.Remove(myWebRequest.RequestUri, "Basic")
Console.WriteLine(ControlChars.Cr + "Your credentials have now been removed from the program's CredentialCache")
myWebResponse.Close()

Remarques

Cette méthode supprime un NetworkCredential instance du si le préfixe d’URI et le CredentialCache protocole d’authentification spécifiés correspondent à ceux associés aux informations d’identification. Plusieurs appels à la Remove méthode pour le même NetworkCredential n’ont aucun effet.

Si authType est null ou uriPrefix est null, ou si aucune information d’identification correspondante n’est trouvée dans le cache, cette méthode ne fait rien.

S’applique à

Remove(String, Int32, String)

Source:
CredentialCache.cs
Source:
CredentialCache.cs
Source:
CredentialCache.cs

Supprime une instance de NetworkCredential du cache si elle est associée à l’hôte, au port et au protocole d’authentification spécifiés.

public:
 void Remove(System::String ^ host, int port, System::String ^ authenticationType);
public void Remove (string host, int port, string authenticationType);
public void Remove (string? host, int port, string? authenticationType);
member this.Remove : string * int * string -> unit
Public Sub Remove (host As String, port As Integer, authenticationType As String)

Paramètres

host
String

String qui identifie l’ordinateur hôte.

port
Int32

Int32 qui spécifie le port auquel se connecter sur host

authenticationType
String

String qui identifie le schéma d'authentification utilisé lors de la connexion à host.

Remarques

Cette méthode supprime un NetworkCredential instance du si l’hôte, le port et le CredentialCache protocole d’authentification spécifiés correspondent à ceux associés aux informations d’identification. Plusieurs appels à la Remove méthode pour le même NetworkCredential n’ont aucun effet.

Si authType est null ou uriPrefix est null, ou si aucune information d’identification correspondante n’est trouvée dans le cache, cette méthode ne fait rien.

S’applique à