I would like to convert a URL like this: http://www.google.com
to this google.com
. So if the format of the URL is like this http://google.com it will be converted to this google.com
I need to determine if two urls are the same no matter the format of the URL. Is there a way to do this. I am using the Uri l开发者_开发技巧ibrary in C# but the host value is different for http://www.google.com
and http://google.com
You can use the Uri
class to parse URIs.
Example: Get just the domain name from a URL?
You can extract more than the host name, too. Here is a full list of properties you can get from a Uri
instance: http://msdn.microsoft.com/en-us/library/system.uri_properties(v=VS.71).aspx
精彩评论