I have a System.Uri, e.g.,
var uri = new Uri("http://www.domain.com/foo/bar");
How do I get only the relative Uri out of it:
/foo/bar
I have a System.Uri, e.g.,
var uri = new Uri("http://www.domain.com/foo/bar");
How do I get only the relative Uri out of it:
/foo/bar
What you are looking for is either Uri.AbsolutePath or Uri.PathAndQuery. PathAndQuery will include the querystring (which you don't have in your question), while AbsolutePath will give you just the path.
Console.WriteLine(uri.PathAndQuery);
// or
Console.WriteLine(uri.AbsolutePath);
...outputs the following results for both...
/foo/bar