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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.
…outputs the following results for both…