chrisname 0 Light Poster

I reworked my code into a way that was simpler.

I have a URL in the following format: "http://sub.domain.tld/path/to/page"
I need to extract 'path' and 'page' and discard the rest of the URL.

I know about the System.Uri class and with Uri.AbsolutePath I can get "/path/to/page/". I need a way of splitting that into 'path' and 'page'. I can currently do it with the String.SubString / String.IndexOf / String.LastIndexOf methods but that requires bounds checking and checking the return values of each method to be safe. Is there a simpler and more robust way?