C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Get MAC address of your system


Posted Date: 08 May 2007    Resource Type: Code Snippets    Category: Network

Posted By: Vinod Sharma       Member Level: Silver
Rating:     Points: 10



This sample code shows how to retrieve the MAC address of your computer using C#. Can convert this code to VB.NET easily.

public string GetMACAddress()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
string MACAddress = String.Empty;
foreach (ManagementObject mo in moc)
{
if (MACAddress == String.Empty) // only return MAC Address from first card
{
if ((bool)mo["IPEnabled"] == true) MACAddress = mo["MacAddress"].ToString();
}
mo.Dispose();
}

MACAddress = MACAddress.Replace(":", "");
return MACAddress;
}




Responses

Author: JAYARAJA    08 May 2007Member Level: Gold   Points : 0
gud info thanks for sharing


Author: Raj Kumar Prajapati    27 Aug 2008Member Level: Bronze   Points : 0
IT WORK
THANKS

RAJ PRAJAPAI


Author: Raj Kumar Prajapati    27 Aug 2008Member Level: Bronze   Points : 0
IT WORK
THANKS

RAJ PRAJAPATI




Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Check if a port is open or closed?
Previous Resource: How to monitor the network performance using Performance counter?
Return to Discussion Resource Index
Post New Resource
Category: Network


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use