I want to check if a URI returns a valid result. Example:
String path = String.Format("{0}/agreements/{1}.gif", PicRoot, languageTwoLetterCode);
WebRequest request = WebRequest.Create(new Uri(path, UriKind.Relative));
...
This throws a notsuportedexception. So I figure I should be providing the absolute URI. All examples I can find use a hardcoded root (like www.example.com). This is off course unacceptable because it is uncertain what the actual root of the website will be.
How can I either check the result from a relative URI or find the current root? Are there better ways to check if say "/content/pics/agreements/en.gif" returns a gif or a 404?