To fetch IP address of system through X++


static void FetchIpAddress (Args _args)
{
System.String                       hostName = System.Net.Dns::GetHostName();
System.Net.IPHostEntry              hostEntry = System.Net.Dns::GetHostEntry(hostName);
System.Net.IPAddress[]              addresses = hostEntry.get_AddressList();
System.Net.IPAddress                address;
System.Net.Sockets.AddressFamily    addressFamily;
System.Collections.IEnumerator      enumerator = addresses.GetEnumerator();

while (enumerator.MoveNext())
{
    address = enumerator.get_Current();
    addressFamily = address.get_AddressFamily();
    if (addressFamily == System.Net.Sockets.AddressFamily::InterNetwork)
    {
        info(address.ToString());
    }
}
}

2 comments:

  1. Is there a way to get the IP address of a system without using .Net classes through X++ in ax 2009?

    ReplyDelete
  2. A strong password will mean that even if someone has access to your network, they will not be able to make changes to your router. 192.168.0.1.1

    ReplyDelete

Powered by Blogger.