Top level domain from URL in C#

后端 未结 7 1293
误落风尘
误落风尘 2020-11-29 10:11

I am using C# and ASP.NET for this.

We receive a lot of \"strange\" requests on our IIS 6.0 servers and I want to log and catalog these by domain.

Eg. we get

7条回答
  •  遥遥无期
    2020-11-29 10:54

    This is not possible without a up-to-date database of different domain levels.

    Consider:

    s1.moh.gov.cn
    moh.gov.cn
    s1.google.com
    google.com
    

    Then at which level you want to get the domain? It's completely depends of the TLD, SLD, ccTLD... because ccTLD in under control of countries they may define very special SLD which is unknown to you.

提交回复
热议问题