Possible Duplicate:
Check if 2 URLs are equal
Sometimes there are differences in ways that urls are typed but at the end they are equivalent. For example capital letters can be converted to lower case and a forward slash at the end or the url can be removed. As an example the two URLs are equivalent:
I am wondering what is the best way to make sure that two URLs are equivalent? what conditions are sufficient to make sure that two urls are pointing to the same document? (I am coding in C# so it would be nice to see if there is a library that can do that too)
Thanks
Just look at the Uri library. For example you could compare by doing the following:
For example:
Uri uri1 = new Uri(url1);
Uri uri2 = new Uri(url2);
// Check urls
if (uri1.AbsolutePath == uri2.AbsolutePath)
{
// Urls match
}
You might also need to first look into doing URL Normalization:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With