Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

asp.net core mvc jsonresult example

public IActionResult ErrorJSON()
        {
            //return json with 400 error code with message
            return new JsonResult(new { message = "Error Messages" })
            {
                StatusCode = StatusCodes.Status400BadRequest // Status code here 
            };
        }
 
PREVIOUS NEXT
Tagged: #core #mvc #jsonresult
ADD COMMENT
Topic
Name
6+6 =