WebProxy Constructeurs

Définition

Initialise une nouvelle instance de la classe WebProxy.

Surcharges

WebProxy()

Initialise une instance vide de la classe WebProxy.

WebProxy(String, Boolean, String[], ICredentials)

Initialise une nouvelle instance de la classe WebProxy avec l’URI, le paramètre d’exception, la liste des URI à ignorer et les informations d’identification spécifiés.

WebProxy(Uri, Boolean, String[])

Initialise une nouvelle instance de la classe WebProxy avec l’instance de Uri, le paramètre d’exception et la liste des URI à ignorer spécifiés.

WebProxy(String, Boolean, String[])

Initialise une nouvelle instance de la classe WebProxy avec l’URI, le paramètre d’exception et la liste des URI à ignorer spécifiés.

WebProxy(Uri, Boolean)

Initialise une nouvelle instance de la classe WebProxy avec l’instance de Uri et le paramètre d’exception.

WebProxy(Uri, Boolean, String[], ICredentials)

Initialise une nouvelle instance de la classe WebProxy avec l’instance de Uri, le paramètre d’exception, la liste des URI à ignorer et les informations d’identification spécifiés.

WebProxy(String, Boolean)

Initialise une nouvelle instance de la classe WebProxy avec l’URI et le paramètre d’exception spécifiés.

WebProxy(SerializationInfo, StreamingContext)
Obsolète.

Initialise une instance de la classe WebProxy avec du contenu précédemment sérialisé.

WebProxy(Uri)

Initialise une nouvelle instance de la classe WebProxy issue de l'instance Uri spécifiée.

WebProxy(String)

Initialise une nouvelle instance de la classe WebProxy avec l'URI spécifié.

WebProxy(String, Int32)

Initialise une nouvelle instance de la classe WebProxy avec l’hôte et le numéro de port spécifiés.

WebProxy()

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une instance vide de la classe WebProxy.

public:
 WebProxy();
public WebProxy ();
Public Sub New ()

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxy()
{
   return gcnew WebProxy;
}
public static WebProxy CreateProxy()
{
    return new WebProxy();
}

Remarques

Le constructeur sans paramètre initialise un instance vide de la classe avec la WebProxyAddress propriété définie sur null.

Lorsque la propriété a nullla Address valeur , la IsBypassed méthode retourne true et la GetProxy méthode retourne l’adresse de destination.

S’applique à

WebProxy(String, Boolean, String[], ICredentials)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’URI, le paramètre d’exception, la liste des URI à ignorer et les informations d’identification spécifiés.

public:
 WebProxy(System::String ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList, System::Net::ICredentials ^ Credentials);
public WebProxy (string? Address, bool BypassOnLocal, string[]? BypassList, System.Net.ICredentials? Credentials);
public WebProxy (string Address, bool BypassOnLocal, string[] BypassList, System.Net.ICredentials Credentials);
new System.Net.WebProxy : string * bool * string[] * System.Net.ICredentials -> System.Net.WebProxy
Public Sub New (Address As String, BypassOnLocal As Boolean, BypassList As String(), Credentials As ICredentials)

Paramètres

Address
String

URI du serveur proxy.

BypassOnLocal
Boolean

true pour ignorer le proxy pour les adresses locales ; sinon, false.

BypassList
String[]

Tableau de chaînes d’expressions régulières qui contient les URI des serveurs à ignorer.

Credentials
ICredentials

Instance de ICredentials à envoyer au serveur proxy pour l’authentification.

Exceptions

Address n’est pas un URI valide.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithCredentials( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( "http://contoso",
      bypassLocal,
      bypassList,
      CredentialCache::DefaultCredentials );
}
public static WebProxy CreateProxyWithCredentials(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy("http://contoso",
        bypassLocal,
        bypassList,
        CredentialCache.DefaultCredentials);
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur un Uri instance qui contient Address, la BypassProxyOnLocal propriété définie BypassOnLocalsur , la BypassList propriété définie BypassListsur et la Credentials propriété définie sur Credentials.

Voir aussi

S’applique à

WebProxy(Uri, Boolean, String[])

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’instance de Uri, le paramètre d’exception et la liste des URI à ignorer spécifiés.

public:
 WebProxy(Uri ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList);
public WebProxy (Uri? Address, bool BypassOnLocal, string[]? BypassList);
public WebProxy (Uri Address, bool BypassOnLocal, string[] BypassList);
new System.Net.WebProxy : Uri * bool * string[] -> System.Net.WebProxy
Public Sub New (Address As Uri, BypassOnLocal As Boolean, BypassList As String())

Paramètres

Address
Uri

Instance de Uri contenant l’adresse du serveur proxy.

BypassOnLocal
Boolean

true pour ignorer le proxy pour les adresses locales ; sinon, false.

BypassList
String[]

Tableau de chaînes d’expressions régulières qui contient les URI des serveurs à ignorer.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithBypassList( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( gcnew Uri( "http://contoso" ),
      bypassLocal,
      bypassList );
}
public static WebProxy CreateProxyWithBypassList(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy(new Uri("http://contoso"),
        bypassLocal,
        bypassList);
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur Address, la BypassProxyOnLocal propriété définie sur BypassOnLocalet la BypassList propriété définie sur BypassList.

S’applique à

WebProxy(String, Boolean, String[])

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’URI, le paramètre d’exception et la liste des URI à ignorer spécifiés.

public:
 WebProxy(System::String ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList);
public WebProxy (string? Address, bool BypassOnLocal, string[]? BypassList);
public WebProxy (string Address, bool BypassOnLocal, string[] BypassList);
new System.Net.WebProxy : string * bool * string[] -> System.Net.WebProxy
Public Sub New (Address As String, BypassOnLocal As Boolean, BypassList As String())

Paramètres

Address
String

URI du serveur proxy.

BypassOnLocal
Boolean

true pour ignorer le proxy pour les adresses locales ; sinon, false.

BypassList
String[]

Tableau de chaînes d’expressions régulières qui contiennent les URI des serveurs à ignorer.

Exceptions

Address n’est pas un URI valide.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithHostAndBypassList( bool bypassLocal )
{
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( "http://contoso",
      bypassLocal,
      bypassList );
}
public static WebProxy CreateProxyWithHostAndBypassList(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy("http://contoso",
        bypassLocal,
        bypassList);
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur un Uri instance qui contient Address, la BypassProxyOnLocal propriété définie sur BypassOnLocalet la BypassList propriété définie sur BypassList.

Voir aussi

S’applique à

WebProxy(Uri, Boolean)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’instance de Uri et le paramètre d’exception.

public:
 WebProxy(Uri ^ Address, bool BypassOnLocal);
public WebProxy (Uri? Address, bool BypassOnLocal);
public WebProxy (Uri Address, bool BypassOnLocal);
new System.Net.WebProxy : Uri * bool -> System.Net.WebProxy
Public Sub New (Address As Uri, BypassOnLocal As Boolean)

Paramètres

Address
Uri

Instance de Uri contenant l’adresse du serveur proxy.

BypassOnLocal
Boolean

true pour ignorer le proxy pour les adresses locales ; sinon, false.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithExampleAddress( bool bypassLocal )
{
   return gcnew WebProxy( gcnew Uri( "http://contoso" ), bypassLocal );
}
public static WebProxy CreateProxyWithExampleAddress(bool bypassLocal)
{
    return new WebProxy(new Uri("http://contoso"), bypassLocal);
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur Address et avec la BypassProxyOnLocal propriété définie sur BypassOnLocal.

S’applique à

WebProxy(Uri, Boolean, String[], ICredentials)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’instance de Uri, le paramètre d’exception, la liste des URI à ignorer et les informations d’identification spécifiés.

public:
 WebProxy(Uri ^ Address, bool BypassOnLocal, cli::array <System::String ^> ^ BypassList, System::Net::ICredentials ^ Credentials);
public WebProxy (Uri? Address, bool BypassOnLocal, string[]? BypassList, System.Net.ICredentials? Credentials);
public WebProxy (Uri Address, bool BypassOnLocal, string[] BypassList, System.Net.ICredentials Credentials);
new System.Net.WebProxy : Uri * bool * string[] * System.Net.ICredentials -> System.Net.WebProxy
Public Sub New (Address As Uri, BypassOnLocal As Boolean, BypassList As String(), Credentials As ICredentials)

Paramètres

Address
Uri

Instance de Uri contenant l’adresse du serveur proxy.

BypassOnLocal
Boolean

true pour ignorer le proxy pour les adresses locales ; sinon, false.

BypassList
String[]

Tableau de chaînes d’expressions régulières qui contient les URI des serveurs à ignorer.

Credentials
ICredentials

Instance de ICredentials à envoyer au serveur proxy pour l’authentification.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithCredentials2( bool bypassLocal )
{
   
   // Do not use the proxy server for Contoso.com URIs.
   array<String^>^ bypassList = {";*.Contoso.com"};
   return gcnew WebProxy( gcnew Uri( "http://contoso" ),
      bypassLocal,
      bypassList,
      CredentialCache::DefaultCredentials );
}
public static WebProxy CreateProxyWithCredentials2(bool bypassLocal)
{
    // Do not use the proxy server for Contoso.com URIs.
    string[] bypassList = new string[]{";*.Contoso.com"};
    return new WebProxy(new Uri("http://contoso"),
        bypassLocal,
        bypassList,
        CredentialCache.DefaultCredentials);
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie Addresssur , la BypassProxyOnLocal propriété définie BypassOnLocalsur , la BypassList propriété définie sur BypassListet la Credentials propriété définie sur Credentials.

S’applique à

WebProxy(String, Boolean)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’URI et le paramètre d’exception spécifiés.

public:
 WebProxy(System::String ^ Address, bool BypassOnLocal);
public WebProxy (string? Address, bool BypassOnLocal);
public WebProxy (string Address, bool BypassOnLocal);
new System.Net.WebProxy : string * bool -> System.Net.WebProxy
Public Sub New (Address As String, BypassOnLocal As Boolean)

Paramètres

Address
String

URI du serveur proxy.

BypassOnLocal
Boolean

true pour ignorer le proxy pour les adresses locales ; sinon, false.

Exceptions

Address n’est pas un URI valide.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithHostAddress( bool bypassLocal )
{
   WebProxy^ proxy = gcnew WebProxy( "http://contoso",bypassLocal );
   Console::WriteLine( "Bypass proxy for local URIs?: {0}", 
      proxy->BypassProxyOnLocal );
   return proxy;
}
public static WebProxy CreateProxyWithHostAddress(bool bypassLocal)
{
    WebProxy proxy =  new WebProxy("http://contoso", bypassLocal);
    Console.WriteLine("Bypass proxy for local URIs?: {0}",
       proxy.BypassProxyOnLocal);
    return proxy;
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur un Uri instance qui contient Address et la BypassProxyOnLocal propriété définie sur BypassOnLocal.

Voir aussi

S’applique à

WebProxy(SerializationInfo, StreamingContext)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Attention

This API supports obsolete formatter-based serialization. It should not be called or extended by application code.

Initialise une instance de la classe WebProxy avec du contenu précédemment sérialisé.

protected:
 WebProxy(System::Runtime::Serialization::SerializationInfo ^ serializationInfo, System::Runtime::Serialization::StreamingContext streamingContext);
protected WebProxy (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
[System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
protected WebProxy (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);
new System.Net.WebProxy : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebProxy
[<System.Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId="SYSLIB0051", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Net.WebProxy : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Net.WebProxy
Protected Sub New (serializationInfo As SerializationInfo, streamingContext As StreamingContext)

Paramètres

serializationInfo
SerializationInfo

Données de sérialisation.

streamingContext
StreamingContext

Contexte des données de sérialisation.

Attributs

Remarques

Cette méthode est appelée par le système pour désérialiser un WebProxy instance ; les applications ne l’appellent pas.

S’applique à

WebProxy(Uri)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy issue de l'instance Uri spécifiée.

public:
 WebProxy(Uri ^ Address);
public WebProxy (Uri? Address);
public WebProxy (Uri Address);
new System.Net.WebProxy : Uri -> System.Net.WebProxy
Public Sub New (Address As Uri)

Paramètres

Address
Uri

Instance de Uri contenant l’adresse du serveur proxy.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithExampleAddress()
{
   return gcnew WebProxy( gcnew Uri( "http://contoso" ) );
}
public static WebProxy CreateProxyWithExampleAddress()
{
    return new WebProxy(new Uri("http://contoso"));
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur le Address paramètre .

S’applique à

WebProxy(String)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l'URI spécifié.

public:
 WebProxy(System::String ^ Address);
public WebProxy (string? Address);
public WebProxy (string Address);
new System.Net.WebProxy : string -> System.Net.WebProxy
Public Sub New (Address As String)

Paramètres

Address
String

URI du serveur proxy.

Exceptions

Address n’est pas un URI valide.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithHost()
{
   return gcnew WebProxy( "http://contoso" );
}
public static WebProxy CreateProxyWithHost()
{
    return new WebProxy("http://contoso");
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur un Uri instance contenant Address.

S’applique à

WebProxy(String, Int32)

Source:
WebProxy.cs
Source:
WebProxy.cs
Source:
WebProxy.cs

Initialise une nouvelle instance de la classe WebProxy avec l’hôte et le numéro de port spécifiés.

public:
 WebProxy(System::String ^ Host, int Port);
public WebProxy (string Host, int Port);
new System.Net.WebProxy : string * int -> System.Net.WebProxy
Public Sub New (Host As String, Port As Integer)

Paramètres

Host
String

Nom de l’hôte proxy.

Port
Int32

Numéro de port de Host à utiliser.

Exceptions

L’URI constitué en combinant Host et Port n’est pas un URI valide.

Exemples

L’exemple de code suivant illustre l’appel de ce constructeur.

WebProxy^ CreateProxyWithHostAndPort()
{
   return gcnew WebProxy( "contoso",80 );
}
public static WebProxy CreateProxyWithHostAndPort()
{
    return new WebProxy("contoso", 80);
}

Remarques

Le WebProxy instance est initialisé avec la Address propriété définie sur un Uri instance du formulaire http:// Host : Port.

S’applique à