CredentialCache.Remove Metoda

Definicja

Usuwa NetworkCredential wystąpienie z pamięci podręcznej.

Przeciążenia

Remove(Uri, String)

NetworkCredential Usuwa wystąpienie z pamięci podręcznej, jeśli jest skojarzone z określonym prefiksem identyfikatora URI (Uniform Resource Identifier) i protokołem uwierzytelniania.

Remove(String, Int32, String)

NetworkCredential Usuwa wystąpienie z pamięci podręcznej, jeśli jest skojarzone z określonym hostem, portem i protokołem uwierzytelniania.

Remove(Uri, String)

Źródło:
CredentialCache.cs
Źródło:
CredentialCache.cs
Źródło:
CredentialCache.cs

NetworkCredential Usuwa wystąpienie z pamięci podręcznej, jeśli jest skojarzone z określonym prefiksem identyfikatora URI (Uniform Resource Identifier) i protokołem uwierzytelniania.

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)

Parametry

uriPrefix
Uri

Element Uri określający prefiks identyfikatora URI zasobów, dla których są używane poświadczenia.

authType
String

Schemat uwierzytelniania używany przez hosta o nazwie w uriPrefix.

Przykłady

W poniższym przykładzie kodu użyto tej metody do usunięcia NetworkCredential wystąpienia z pamięci podręcznej.

// 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()

Uwagi

Ta metoda usuwa NetworkCredential wystąpienie z CredentialCache obiektu , jeśli określony prefiks identyfikatora URI i protokół uwierzytelniania są zgodne z poświadczeniami. Wiele wywołań Remove metody dla tej samej NetworkCredential metody nie ma wpływu.

Jeśli authType element ma null wartość lub uriPrefixnulljest lub nie znaleziono pasujących poświadczeń w pamięci podręcznej, ta metoda nic nie robi.

Dotyczy

Remove(String, Int32, String)

Źródło:
CredentialCache.cs
Źródło:
CredentialCache.cs
Źródło:
CredentialCache.cs

NetworkCredential Usuwa wystąpienie z pamięci podręcznej, jeśli jest skojarzone z określonym hostem, portem i protokołem uwierzytelniania.

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)

Parametry

host
String

Element String identyfikujący komputer hosta.

port
Int32

Element Int32 określający port, z który ma nawiązać połączenie w systemie host.

authenticationType
String

Element String identyfikujący schemat uwierzytelniania używany podczas nawiązywania połączenia z usługą host.

Uwagi

Ta metoda usuwa NetworkCredential wystąpienie z CredentialCache obiektu , jeśli określony host, port i protokół uwierzytelniania są zgodne z poświadczeniami. Wiele wywołań Remove metody dla tej samej NetworkCredential metody nie ma wpływu.

Jeśli authType element ma null wartość lub uriPrefixnulljest lub nie znaleziono pasujących poświadczeń w pamięci podręcznej, ta metoda nic nie robi.

Dotyczy