NetworkState.IsDestinationReachable Method
Gets a value that indicates whether a connection can be made to the specified network destination.
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
Syntax
'Declaration
Public MustOverride Function IsDestinationReachable ( _
destination As String _
) As Boolean
'Usage
Dim instance As NetworkState
Dim destination As String
Dim returnValue As Boolean
returnValue = instance.IsDestinationReachable(destination)
public abstract bool IsDestinationReachable(
string destination
)
Parameters
destination
Type: System.StringSpecifies the location to check for network connectivity as a Uniform Resource Locator (URL), universal naming convention (UNC) path, or IP address.
Return Value
Type: System.Boolean
true if a connection can be made to the specified URL, UNC path, or IP address; otherwise, false.
Exceptions
Exception | Condition |
---|---|
FileNotFoundException | The location of the destination cannot be found. |
ArgumentNullException | The parameter passed to this method is a null reference (Nothing in Visual Basic). |
ArgumentException | The parameter passed to this method is not valid. For example, it is of the wrong type or format. |
Remarks
The value specified for destination must be either a UNC path that includes a server name and a share name, such as @"\\\\MyServer\\MyShare", or a URL that begins with one of the following protocol identifiers: http, https, or file.
This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.
In the following code example, clicking the Button control displays whether a connection can be made to the specified URL.
using Microsoft.Office.InfoPath;
string result = formControl1.XmlForm.NetworkState.IsDestinationReachable(
"https://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( _
"https://www.microsoft.com").ToString()
' Display result in a message box.
MessageBox.Show("Can connect to Microsoft.com = " & result)