With the new version of HttpClient
and without the WebApi
package it would be:
var content = new StringContent(jsonObject.ToString(), Encoding.UTF8, "application/json");
var result = client.PostAsync(url, content).Result;
Or if you want it async
:
var result = await client.PostAsync(url, content);
More Related Contents:
- What’s the difference between WCF Web API and ASP.NET Web API
- WCF Service or Web API [closed]
- Failed to serialize the response in Web API with Json
- Why is HttpContext.Current null after await?
- prevent property from being serialized in web API
- The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application
- How to update a claim in ASP.NET Identity?
- What is the difference between PreserveReferencesHandling and ReferenceLoopHandling in Json.Net?
- 404 error after adding Web API to an existing MVC Web Application
- Pattern for calling WCF service using async/await
- Make ASP.NET WCF convert dictionary to JSON, omitting “Key” & “Value” tags
- ASP.NET WebApi: how to perform a multipart post with file upload using WebApi HttpClient
- Queuing in OneWay WCF Messages using Windows Service and SQL Server
- Can we create custom HTTP Status codes?
- Order of execution with multiple filters in web api
- Pass multiple complex objects to a post/put Web API method
- ASP.NET 5 add WCF service reference
- TempData null in asp.net core
- How to add cross domain support to WCF service
- How to natively enable JSONP for existing WCF service?
- How can I pass a username/password in the header to a SOAP WCF Service
- POST string to ASP.NET Web Api application – returns null
- How to add Web API to an existing ASP.NET MVC (5) Web Application project?
- Simple JWT authentication in ASP.NET Core 1.0 Web API
- Disable *all* exception handling in ASP.NET Web API 2 (to make room for my own)?
- Best practice for error handling with ASP.NET Web API
- Web Service without adding a reference?
- Dynamically switch WCF Web Service Reference URL path through config file
- Is there a way in Json.NET serialization to distinguish between “null because not present” and “null because null”?
- How to get hold of Content that is already read