Last post Jul 30, 2019 07:49 AM by Yongqing Yu
Jul 29, 2019 05:47 PM|itsatifriaz|LINK
Hi! I want to save new data in an online API in ASP.NET C# Windows form
If anyone can tell me if it's possible and if it is how can we do it..
any help will be appreciated.
Jul 30, 2019 07:49 AM|Yongqing Yu|LINK
if it's possible and if it is how can we do it..
Yes, it is possible to do it.
First, you need to create an empty project of a new WebAPI application, use the
post method of the WebAPI to upload files to the web server, write the corresponding method of uploading files in the controller, so that the WinForm application can call the api.
Then, create a WinForm application and install
Microsoft.AspNet.WebApi.Client and Newtonsoft.JSON using NuGet Package Manager.
Add the upload button and openFileDialog to select the uploaded file in the design page.
In the click event, upload the file to the file path set by the web server through the URL of the WebAPI .
For more details, there is a detailed tutorial in this link, you could refer to it: Consume Web API In Winform For File Handling