I am converting absolute file-system path to relative path using following code.
public static void Main(string[] args)
{
System.Uri uri1 = new Uri(@"C:\Users\301591\Downloads\My Pics\abcd.jpg", true);
System.Uri uri2 = new Uri(@"C:\Users\301591\", true);
Uri relativeUri = uri2.MakeRelativeUri(uri1);
Console.WriteLine(relativeUri.ToString());
}
The result I am getting is /Downloads/My Pics/abcd.jpg
but compiler is throwing a warning, constructor I am using is marked obsolete.
Uri testUri=new Uri("string path","flag to remove escape sequences");
Is there any other way to create relative path with showing escape sequence in the result?
I found the solution.
It is