NetworkState.IsDestinationReachable(String) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Gets a value that indicates whether a connection can be made to the specified network destination.
public:
abstract bool IsDestinationReachable(System::String ^ destination);
public abstract bool IsDestinationReachable (string destination);
abstract member IsDestinationReachable : string -> bool
Public MustOverride Function IsDestinationReachable (destination As String) As Boolean
Paramètres
- destination
- String
Specifies the location to check for network connectivity as a Uniform Resource Locator (URL), universal naming convention (UNC) path, or IP address.
Retours
true if a connection can be made to the specified URL, UNC path, or IP address; otherwise, false.
Exceptions
L'emplacement de la destination est introuvable.
Le paramètre passé à cette méthode est une référence null (Nothing en Visual Basic).
Le paramètre passé à cette méthode n'est pas valide. Par exemple, le type ou le format est incorrect.
Remarques
La valeur spécifiée pour destination
doit être un chemin UNC qui inclut un nom de serveur et un nom de partage, tel que @"\\MyServer\MyShare », ou une URL commençant par l’un des identificateurs de protocole suivants : http, https ou fichier.
Seuls les formulaires qui s’exécutent dans le même domaine que le formulaire actuellement ouvert ou les formulaires disposant d’autorisations inter-domaines peuvent accéder à ce membre.
Vous pouvez uniquement accéder à ce type ou à ce membre à partir du code exécuté dans les formulaires ouverts dans Microsoft InfoPath Filler.
Dans l'exemple de code ci-dessous, un clic sur le contrôle Button indique si une connexion peut être établie à l'URL spécifiée.
using Microsoft.Office.InfoPath;
string result = formControl1.XmlForm.NetworkState.IsDestinationReachable(
"http://www.microsoft.com").ToString();
// Display result in a message box.
MessageBox.Show("Can connect to Microsoft.com = " + result);
Imports Microsoft.Office.InfoPath
Dim result As String = _
formControl1.XmlForm.NetworkState.IsDestinationReachable( _
"http://www.microsoft.com").ToString()
' Display result in a message box.
MessageBox.Show("Can connect to Microsoft.com = " & result)