<p>I have a base URL :</p>

<pre><code>http://my.server.com/folder/directory/sample
</code></pre>

<p>And a relative one :</p>

<pre><code>../../other/path
</code></pre>

<p>How to get the absolute URL from this ? It's pretty straighforward using string manipulation, but I would like to do this in a secure way, using the <code>Uri</code> class or something similar.</p>

<p>It's for a standard a C# app, not an ASP.NET one.</p>

```
```
var baseUri = new Uri("http://my.server.com/folder/directory/sample");
var absoluteUri = new Uri(baseUri,"../../other/path");
```
```
OR
```
```
Uri uri;
if ( Uri.TryCreate("http://base/","../relative", out uri) ) doSomething(uri);
```
```