Handling relative Uri's in rewritten urls

Hello, i'm writing a simple web spider for whole web crawling. I'm using System.Uri class to resolve relative uri's found on webpages. Everything is fine with standard uri's however some servers use url rewritng scheme which Uri class fails to interpret. Example:

base url: http://www.wosp.org.pl/fundacja/index.php/11/2
relative url: index.php/11/2/0

All browsers resolves that relative url to: http://www.wosp.org.pl/fundacja/index.php/11/2/0

But Uri class resolves to http://www.wosp.org.pl/fundacja/index.php/11/index.php/11/2/0

Unfortunately that url does not generate 404 error so i'm getting more and more urls in my db going like http://www.wosp.org.pl/fundacja/index.php/11/index.php/11/2/index.php/11/2/index.php/11/2/

I've also tested java URI class which behaves in the same way.

So is there a bug in Uri class or maybe that relative url is not valid, but if it is so why does it work with all of the browsers.

Also i would welcome any suggestions on how to deal with that problem.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The issue is not so much with the Uri class as with your spider.

If you look at the source of the page http://www.wosp.org.pl/fundacja/index.php/11/2, you will see that there is a base href tag in the page header:

<base href="http://www.wosp.org.pl/fundacja/">

This tells the browser where to base relative URLs.  Your spider needs to handle these tags.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pherversAuthor Commented:
Great that solves my problem, somehow i wasn't aware of <base>  tag.  It caused a lot of confusion so i guess i won't use it in future either :)
Glad to help:)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.