0
I Use This!
Activity Not Available

Project Summary

.NET domain name parsing componentSummaryA domain name has 3 major parts:

The 'top level' domain, or TLD (like .com, .net, .info) The 'domain name', or SLD (like google, microsoft, ebay) The subdomain (like www, photos)

Parsing a domain name into it's 3 major parts sounds easy, but is no trivial task. What happens when you come across hosts like test.co.uk? What about hosts like www.parliament.uk?

From http://publicsuffix.org :

"Since there is no algorithmic method of finding the highest level at which a domain may be registered for a particular top-level domain (the policies differ with each registry), the only method is to create a list. This is the aim of the Public Suffix List."

The domain name parsing component uses the list of rules at www.publicsuffix.org to parse a domain name into 3 component parts. There are 3 types of rules: 'Normal' domain rules, 'Wildcard' rules, and 'Exception' rules.

Getting startedDownload the latest release from the Downloads section Download the latest rules file Configure your app.config in the to point to the rules file you just downloaded (see the sample app.config included in the .zip) Look at the included unit tests to see how easy the component is to use UsageUsing the component is simple. Just use the constructor or the static 'TryParse' method and pass in the complete host name string. The component will return the parsed domain in a DomainName component. It's as simple as that:

// Try parsing a 'wildcard' domain
if (DomainName.TryParse("photos.verybritish.co.uk", out outDomain))
{
// The domain should be parsed as 'verybritish'
Assert.AreEqual("verybritish", outDomain.Domain);

// The TLD is 'co.uk'
Assert.AreEqual("co.uk", outDomain.TLD);

// The SLD is just an alias for 'Domain':
Assert.AreEqual(outDomain.Domain, outDomain.SLD);

// The subdomain is everything else to the left of the domain:
Assert.AreEqual("photos", outDomain.SubDomain);
}
else
{
Debug.WriteLine("Apparently, we couldn't parse photos.verybritish.co.uk");
}Where can I get the latest rules list?You can download the latest rules from the Public Suffix site.

Tags

dns domain hostname name net parse publicsuffix sld subdomain tld

In a Nutshell, domainname-parser...

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

MIT License
Permitted

Sub-License

Private Use

Commercial Use

Modify

Distribute

Forbidden

Hold Liable

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    you can subscribe to e-mail newsletters to receive update from the Open Hub blog
  • ...
    in 2016, 47% of companies did not have formal process in place to track OS code
  • ...
    by exploring contributors within projects, you can view details on every commit they have made to that project

 No code available to analyze

Open Hub computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Open Hub cannot perform this analysis

Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Open Hub can generate statistics! It's fast and easy - try it and see!

Add a code location

Community Rating

Be the first to rate this project
Click to add your rating
   Spinner
Review this Project!
Sample ohloh analysis