Find Information about your Network Cards using C#

Feb 9, 2010 Posted by Lara Kannan
Find Information about your Network Cards using C#

Here’s a small snippet of code of how to find out which network cards are enabled and able to transmit data on your machine. Here’s the code.

Add a reference to System.Net.NetworkInformation


var nics = NetworkInterface.GetAllNetworkInterfaces()
.Where(o => o.OperationalStatus == OperationalStatus.Up);

foreach (var item in nics)
{
Response.Write(item.Description + "<br />");
Response.Write(item.Name + "<br />");
Response.Write(item.Speed + "<br />");
Response.Write(item.NetworkInterfaceType + "<br /><br />");
}


Share
Labels: ,

Post a Comment