jQuery and ASP.NET

August 31, 2009

Find Information about your Network Cards using C# or VB.NET




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

C#

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 />");
}

VB.NET

Dim nics = NetworkInterface.GetAllNetworkInterfaces()_
.Where(Function(o) o.OperationalStatus = OperationalStatus.Up)

For Each item In nics
Response.Write(item.Description & "<br />")
Response.Write(item.Name & "<br />")
Response.Write(item.Speed & "<br />")
Response.Write(item.NetworkInterfaceType & "<br /><br />")
Next item

The output is below:

clip_image002



'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Malcolm Sheridan is a Microsoft awarded MVP in ASP.NET and regular presenter at conferences and user groups throughout Australia. Being an ASP.NET Insider, his focus is on web technologies and has been for the past 10 years. He loves working with ASP.NET MVC these days and also loves getting his hands dirty with JavaScript. He also blogs regularly at DotNetCurry.com. Follow him on twitter @malcolmsheridan

comments

0 Responses to "Find Information about your Network Cards using C# or VB.NET"
 

Copyright © 2009-2011 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions