ControllerBase.Ok Method

Definition

Overloads

Ok()

Creates an OkResult object that produces an empty Status200OK response.

Ok(Object)

Creates an OkObjectResult object that produces a Status200OK response.

Ok()

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates an OkResult object that produces an empty Status200OK response.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.OkResult Ok ();

Returns

The created OkResult for the response.

Attributes

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0

Ok(Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Creates an OkObjectResult object that produces a Status200OK response.

C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.OkObjectResult Ok (object value);
C#
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.OkObjectResult Ok (object? value);

Parameters

value
Object

The content value to format in the entity body.

Returns

The created OkObjectResult for the response.

Attributes

Applies to

ASP.NET Core 9.0 and other versions
Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0