Generic Web Api Client Request (GET/POST)
Here i am going to explain, how to create generic web api client request, 1. It will helps you to manage all HTTP request from single class. 2. It will helps you to reduce your number of duplicate code as well. (No more repeat code for HTTP client). Use NuGet Package Manager to install the Web API Client Libraries package. From the Tools menu, select NuGet Package Manager > Package Manager Console. In the Package Manager Console (PMC), type the following command: Install-Package Microsoft.AspNet.WebApi.Client Following is the sample code for Generic HTTP request: using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; namespace ApiRequestSample { public class GenericHttpRequest { protected static string HeaderName { get { return "AuthenticationToken"; } } protected static string HeaderValue { get...