Live Chat Icon For mobile
Live Chat Icon

How do you send an HTTP POST request using HttpClient in Blazor?

Platform: Blazor| Category: Web API

An HTTP POST request can be sent to add new data in the API server using the SendJsonAsync () method provided by the HttpClient class.


@page "/employee/add"
@inject HttpClient Http

.. .. .. .. .. .. 
.. .. .. .. .. ..

@code {
    Employee emp = new Employee();
    protected async Task CreateEmployee()
        await Http.SendJsonAsync(HttpMethod.Post, "/api/Employee/Create", emp);


public void Create([FromBody] Employee employee)
    if (ModelState.IsValid)

Reference link:

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.