IWebProxy.Credentials Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
De referenties die moeten worden verzonden naar de proxyserver voor verificatie.
public:
property System::Net::ICredentials ^ Credentials { System::Net::ICredentials ^ get(); void set(System::Net::ICredentials ^ value); };
public System.Net.ICredentials Credentials { get; set; }
member this.Credentials : System.Net.ICredentials with get, set
Public Property Credentials As ICredentials
Waarde van eigenschap
Een ICredentials exemplaar met de referenties die nodig zijn voor het verifiëren van een aanvraag bij de proxyserver.
Voorbeelden
In het volgende voorbeeld wordt de Credentials eigenschap gebruikt om de referenties in te stellen die worden verzonden naar de proxyserver voor verificatie.
public class WebProxy_Interface : IWebProxy
{
// The credentials to be used with the web proxy.
private ICredentials iCredentials;
// Uri of the associated proxy server.
private Uri webProxyUri;
public WebProxy_Interface(Uri proxyUri) {
webProxyUri = proxyUri;
}
// Get and Set the Credentials property.
public ICredentials Credentials {
get {
return iCredentials;
}
set {
if(iCredentials != value)
iCredentials = value;
}
}
// Return the web proxy for the specified destination(destUri).
public Uri? GetProxy(Uri destUri) {
// Always use the same proxy.
return webProxyUri;
}
// Return whether the web proxy should be bypassed for the specified destination(hostUri).
public bool IsBypassed(Uri hostUri) {
// Never bypass the proxy.
return false;
}
}
Public Class WebProxy_Interface
Implements IWebProxy
'The credentials to be used with the web proxy.
Private iCredentials As ICredentials
'Uri of the associated proxy server.
Private webProxyUri As Uri
Sub New(proxyUri As Uri)
webProxyUri = proxyUri
End Sub
'Get and Set the Credentials property.
Public Property Credentials() As ICredentials Implements IWebProxy.Credentials
Get
Return iCredentials
End Get
Set
If iCredentials Is value Then
iCredentials = value
End If
End Set
End Property
'Returns the web proxy for the specified destination(destUri).
Public Function GetProxy(destUri As Uri) As Uri Implements IWebProxy.GetProxy
'Always use the same proxy.
Return webProxyUri
End Function 'GetProxy
'Returns whether the web proxy should be bypassed for the specified destination(hostUri).
Public Function IsBypassed(hostUri As Uri) As Boolean Implements IWebProxy.IsBypassed
'Never bypass the proxy.
Return False
End Function 'IsBypassed
End Class
Opmerkingen
De Credentials eigenschap is een ICredentials exemplaar dat de autorisatiereferenties bevat die naar de proxyserver moeten worden verzonden als reactie op een HTTP 407-statuscode (proxyautorisatie).