How to Use HttpClient With Visual Studio 2017 and Windows 10

I get an error on HttpClient, "the type or namespace cannot be found"

        HttpClient client = new HttpClient();
        var response = await client.GetAsync(queryString);

what "using" should I add? I was not able to download System.Net.Http

Posts

  • N_BauaN_Baua ✭✭✭✭✭ INMember ✭✭✭✭✭
    edited July 2017

    @DeniseJames,

    Hi,
    I am not sure, If sharing dll file, violates any policies of this forum, I only did it for helping you out.
    (I guess, I also did find the dll on internet and still using it from few years.)

    Reference this file in you PCL and use as using System.Net.Http;.

    (Also you would want to use a fully qualified URL not querystring as shown in your code above

    so var response = await client.GetAsync(queryString)

    should be something like
    var response = await client.GetAsync('www.yourdomain.com\productsapi\getproduct?pid=5');
    )

    Hope this helps.

    Regards,
    N Baua

  • DeniseJamesDeniseJames ✭✭ USMember ✭✭
    edited July 2017

    @N_Baua You rule! THank you so much for your response.

    How do I use this .rar file? What is the procedure for Visual Studio 2017?

    I am sure it is fine to share dll files. I take full risk and responsibility of using it.

  • N_BauaN_Baua ✭✭✭✭✭ INMember ✭✭✭✭✭
    edited July 2017

    @DeniseJames said:
    How do I use this .rar file? What is the procedure for Visual Studio 2017?

    Hi,
    Just use winzip or winrar application to extract the dll file from the archive.
    In order to attach here in thread the file have been added as an archive.

    Copy and paste it in your PCL project's bin folder and add that .dll file reference to your project(PCL) and use it.

    Hope this helps.

    Regards,
    N Baua

  • N_BauaN_Baua ✭✭✭✭✭ INMember ✭✭✭✭✭

    @DeniseJames ,

    Can you please mark this as an answer, it helps close the thread and other users to get the answers quickly.

    Regards,
    N Baua

Sign In or Register to comment.