This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Sunday, November 2, 2008

DOTNET CODE Valid MAC address function

public static string IsValidMAC(string macAddress)
{
if (macAddress.StartsWith("/spa")) macAddress = macAddress.Substring(4);
macAddress = macAddress.Replace(":", "");
string result = "";
Regex rx = new Regex("([0-9a-fA-F][0-9a-fA-F]-){5}([0-9a-fA-F][0-9a-fA-F])", RegexOptions.IgnoreCase);
Match m = rx.Match(macAddress);
result = m.Groups[0].Value;
if (result.Length == 17)
{
return result;
}
else
{
rx = new Regex("([0-9a-fA-F][0-9a-fA-F]){5}([0-9a-fA-F][0-9a-fA-F])", RegexOptions.IgnoreCase);
Match m2 = rx.Match(macAddress);
result = m2.Groups[0].Value;
if (result.Length == 12)
{
return result;
}
return result;
}
}

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Blog Archive

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger