Question: I have the following code to concat some URIs:

```
public static Uri BuildUri()
{
    Uri baseUri = new Uri("http://192.168.1.60:8080");
    Uri restUri = new Uri(baseUri, "/rest/api/2");
    Uri url = new Uri(restUri, "/mypreferences?key=my.config.value");

    return url;
}

```

I expect the following address, in the result URI:

```
http://192.168.1.60:8080/rest/api/2/mypreferences?key=my.config.value

```

But I'm getting:

```
http://192.168.1.60:8080/mypreferences?key=my.config.value

```

Would someone please could explain why?

Answer: 
```
void Main()
{
    Uri baseUri = new Uri("http://192.168.1.60:8080");
    Uri restUri = new Uri(baseUri, "/rest/api/2/");
    Uri url = new Uri(restUri, "mypreferences?key=my.config.value");

    Console.WriteLine (url);
}

```

This correctly prints

```
http://192.168.1.60:8080/rest/api/2/mypreferences?key=my.config.value

```

The difference must be because of how it interprets the forward slash in different URI's. Where exactly this is mentioned in the docs I haven't found yet, but at least you have your solution already.
Related: [Appending multiple segments with System.Uri](https://stackoverflow.com/questions/10148499/appending-multiple-segments-with-system-uri)

You want to append a / to the end of your path, and remove it from the first path.

```
Uri baseUri = new Uri( "http://192.168.1.60:8080" );
Uri restUri = new Uri(baseUri, "/rest/api/2/");

```