Get URL using HttpClient C# .NET
<p>I am trying to get the URL of a page using HttpClient. I've previously only used HttpWebRequest, but I need to make this an async method.
In the code below, myUri always returns null which results in throwing an exception when I try to handle it later on.</p>

<p>Is the location header the wrong thing to be using? </p>

<pre><code>        string myUrl = "http://www.example.com/"; 
        Uri myUri= new Uri(myUrl);
        using (HttpClient client = new HttpClient())
        using (HttpResponseMessage response = await client.GetAsync(myUri))
        {
            if (response.IsSuccessStatusCode)
            {
                myUri= response.Headers.Location;
                Debug.WriteLine("True "+ myUri);
            } 
            else {
                Debug.WriteLine("False " + myUri);
            }
        }
</code></pre>