Reputation: 325
Following is my code to get the default NIC in Windows XP, but the same code doesn't work in Windows 7. It's really confusing after reading MSDN. Any solution?
//----------------- Getting all the Nic's --------------------
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
{
//------------ Getting properties of IPV4 ----------------
IPInterfaceProperties ipProps = nic.GetIPProperties();
//------------ Getting the Ip Properties -----------------
if (ipProps.GetIPv4Properties() != null)
{
dic.Add(ipProps.GetIPv4Properties().Index, nic.Name);
}
Error: The request protocol is not configured, or has no implementation.
Upvotes: 3
Views: 378