locked
Universal app HttpClient header error

    Question

  • I'm creating universal application and I need to use Keep-Alive connection header for my requests. I have the code

    using (var client = new HttpClient())
    {
        client.DefaultRequestHeaders.Add("connection", "Keep-Alive");
        var str = await client.GetStringAsync(uri);
        return str;
    }
    but I catch exception The header Connection has an empty value. Please somebody show me where is my mistake and how I can set Connection header to Keep-Alive

    Monday, November 10, 2014 4:54 PM

Answers

  • I've just tried this, and it works fine for me.  Not only that, but keep-alive seems to be the default for Windows.Web.Http.HttpClient anyway (as reported by Fiddler)
    Monday, November 10, 2014 11:26 PM