Skip to Content

Scripting Example - DNS

This example demonstrates how to perform a DNS lookup to validate a given host name.

Table Schema

Column Data Type Primary Key Auto-generate Nullable
HostName NVARCHAR(100) No No No

Script

using System.Net;

string hostName = Row["HostName"].GetValueAsString();

try
{
    IPAddress[] ips = await Dns.GetHostAddressesAsync(hostName);

    if (ips.Length == 0)
    {
        Fail();
    }
}
catch
{
    Fail();
}