Thulasiram pakala

Thulasiram pakala

  • 852
  • 838
  • 105.4k

i am using vs 2010 i want to use webapi

Dec 10 2020 9:45 PM
i am using httpclint and httpcontext name space but this one shows error missing name space i try to instal newget package manager but its not found in command prompt i try to install that version but it will path not found please help i am inew in webapi how to install tha one even i try to download httpclient dll but httpclient show name sapce error only i am using system.http..net  but same error
 
 
using System.Net;
using System.Net.Http;
using System.Web.Script.Serialization;
 
 
 HttpClient client = new HttpClient();
       
        try
        {
            HttpContent inputContent = new StringContent(inputJson, Encoding.UTF8, "application/json");
            HttpResponseMessage response = client.PostAsync(apiUrl, inputContent).Result;
            if (response.IsSuccessStatusCode)
            {
                res = response.Content.ReadAsStringAsync().Result;
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return res;
 
 

Answers (1)