Q:

The HTTP redirect request failed in UWP C# project

I'm getting this error "The HTTP redirect request failed" when I'm trying to get text (whole string) of this url (for example) : "https://apic-desktop.musixmatch.com/ws/1.1/macro.subtitles.get?format=json&q_track=Mi%20Mi%20Mi%20%28Radio%20Edit%29&q_artist=SEREBRO&user_language=en&subtitle_format=mxm&app_id=web-desktop-app-v1.0&usertoken=SECRET TOKEN" but it's worked in chrome and I must get that json file https://pastebin.com/GJdLK3BA (I uploaded it to Pastebin)
Platform:UWP x64
System:Windows 10 pro April Update
public string URLToString(string url)
{
    HttpClient client = new HttpClient();
    HttpResponseMessage response = client.GetAsync(url).Result;
    string result = null;
    if (response.IsSuccessStatusCode)
    {
       result = client.GetStringAsync(url).Result;
    }
    else
    {
       result = null;
    }
    return result;
 }

LyURL = "https://apic-desktop.musixmatch.com/ws/1.1/matcher.lyrics.get?format=json&q_track=" + Uri.EscapeUriString(Title.Text) + "&q_artist=" + Uri.EscapeUriString(Arti.Text) + "&user_language=en&subtitle_format=mxm&app_id=web-desktop-app- v1.0&usertoken=*SECRET TOKEN*";

JObject jObject = JObject.Parse(URLToString(LyURL));

String Lyra = (string)jObject.SelectToken("message.body.lyrics.lyrics_body");

Error Message: The HTTP redirect request failed

A:

The Windows.Web.Http.Headers namespace supports creation of HTTP headers and cookies, which are then associated as properties with HttpRequestMessage and HttpResponseMessage objects. Please add header = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)"; before send get request like the following. For more detail please refer this document.
public async void SendGetMethod(string url, Action<HttpResponseMessage> resopnse)
{
    HttpClient client = new HttpClient();
    var headers = client.DefaultRequestHeaders;
    string header = "";
    if (!headers.UserAgent.TryParseAdd(header))
    {
        // throw new Exception("Invalid header value: " + header);
    }
    header = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)";
    if (!headers.UserAgent.TryParseAdd(header))
    {
        throw new Exception("Invalid header value: " + header);
    }
    HttpResponseMessage httpResponse = new HttpResponseMessage();
    Uri requestUri = new Uri(url);
    try
    {
        httpResponse = await client.GetAsync(requestUri);
        httpResponse.EnsureSuccessStatusCode();
        resopnse(httpResponse);
    }
    catch (Exception ex)
    {
        Debug.Write("Error: " + ex.HResult.ToString("X") + " Message: " + ex.Message);
    }
}

Usage
SendGetMethod("url",(res)=>{
                 var result = res
            });

 

