using System;
using System.Collections.Generic;
using System.Text;
using System.Net.NetworkInformation;
public class ClsGatewayID
{
private static string _GatewayID = string.Empty;
public static string GatewayID
{
get
{
return mGetGatewayID();
}
}
private static string mGetGatewayID()
{
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
GatewayIPAddressInformationCollection addresses = adapterProperties.GatewayAddresses;
if (addresses.Count > 0)
{
foreach (GatewayIPAddressInformation address in addresses)
{
if(string.IsNullOrEmpty(_GatewayID))
_GatewayID += address.Address.ToString();
else
_GatewayID += address.Address.ToString() + "\r\n";
}
}
}
return _GatewayID;
}
}
Difference between Rollup and Cube
14 years ago
No comments:
Post a Comment