简体   繁体   中英

ASP.NET Core Web API - Create Custom Requests and Responses

I'm completely new to .NET and C# programming. I'm working on a project that requires me to develop a .NET base web application.

I have been able to do most parts of the project but I'm having issues with the ASP.NET Core Web API.

I want to make HTTP Get request from the front end but I do not know how to remove the WeatherForecast sample and write my own requests and response.

Any help regarding how to create the basic template for the HTTP requests would be highly appreciated.

Thank you!

I want to make HTTP Get request from the front end Web api doesn't contain front end.If you want to send requests in web api,you can try to use HttpClient,here is a sample with get request:

HttpClient client = new HttpClient();
 HttpResponseMessage response = await client.GetAsync("{url}");

For more details,you can refer to the doc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM