Skip to main content

Posts

Showing posts with the label Calling Web API Using HttpClient

How To Consume REST API in C#.NET using HttpClient | .Net Core

HttpClient class provides a base class for sending/receiving the HTTP requests/responses from a URL. It’s supported to the async feature of .NET framework. The HttpClient is able to process multiple concurrent requests. It’s a layer over HttpWebRequest and HttpWebResponse. All methods with HttpClient are asynchronous. Example for making a Get/POST Request,     var encriptedUserLogin = "hijksds@34dff@556";     var encriptedPwd = "jsdjhll!23392mf544134";     //GET CALL     string apiURL = "http://localhost:62028/api/Users/Authenticate" ;     UriBuilder builder = new UriBuilder(apiURL);                             builder.Query = "Username=" + encriptedUserLogin + "&Password=" + encriptedPwd + "" ;     using ( var client = new HttpC...