Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
http://www.codeproject.com/Questions/ask.aspx ==> http://www.codeproject.com

http://t.codeproject.com/Questions/ask.aspx ==> http://www.codeproject.com

http://news.codeproject.com/Questions/ask.aspx ==> http://www.codeproject.com

http://news.codeproject.com.cn/Questions/ask.aspx ==> http://www.codeproject.com.cn


Above is example,I want to get the top level domain.


===
use the uri class I just get the sub level domain for above 2~4 example
Posted
Updated 28-Mar-11 23:37pm
v4
Comments
OriginalGriff 28-Mar-11 8:24am    
Don't bump your question, it's rude.
Additionally, if you bump it by posting "Thank U" as a solution it removes it from the unanswered list and makes it less likely to ever get an answer...

Solution deleted.
lukeer 28-Mar-11 9:58am    
I doubt the examples to be correct because "www.codeproject.com" isn't even present in "t.news.codeproject.com".

Are you sure you want the result to start with "www" by all means?
njwu 29-Mar-11 5:32am    
yes, I made mistake. BUT use the uri class I just get the sub level domain for above 2~4 example

then I must do something with the string ? cut the string or replace the substring before the first dot with "www"

1 solution

For the four example Uris you have given, the top level domain for the first three is 'com' and for the last it is 'cn' and I do not think that this is really what you want.

Therefore please do some research into the names of the various parts of a uri/url and edit your question to indicate what you really want.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900