public static void Main()
Console.WriteLine(ReplacePath("http://localhost:61310/StringtoConvert?Id=1", "ConvertedString"));
private static string ReplacePath(string url, string newPath)
return $"{uri.GetLeftPart(UriPartial.Authority)}/{newPath}{uri.Query}";