To get the LAN domain name and default gateway address try the below code
Note: don't forget to include the namespace
using System.Net.NetworkInformation;
IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
string intranetDomainName = ipProperties.DomainName;
foreach (NetworkInterface networkCard in NetworkInterface.GetAllNetworkInterfaces())
{
foreach (GatewayIPAddressInformation gatewayAddress in networkCard.GetIPProperties().GatewayAddresses)
{
string defaultGatewayAddress = gatewayAddress.Address.ToString();
}
}
Tuesday, August 26, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment