Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

.net json result status code not working

 //return json with 400 error code with message
            return new JsonResult(new { message = "Error Messages" })
            {
                StatusCode = StatusCodes.Status400BadRequest // Status code here 
            };

//return json with 200 OK status code (it's an Ok type of ObjectResult)
            return new OkObjectResult(new Student { Id = 123, Name = "Hero" });
Comment

PREVIOUS NEXT
Code Example
Csharp :: loading player preferences unity 
Csharp :: C# Convert 1 range to another 
Csharp :: c# read excel file using epplus save to datatable 
Csharp :: substring in c# 
Csharp :: asp net saber ip address of client machine IIS 
Csharp :: kendo validator tries to validate hidden fields 
Csharp :: read json from assets c# 
Csharp :: c# centos Regex Username 
Csharp :: superscript list 
Csharp :: csharp 3d array length 
Csharp :: Options Pattern startup.cs configuration 
Csharp :: unity rigidbody freeze rotation y z 
Csharp :: store data between razor pages 
Csharp :: C# order a sorted list by key 
Csharp :: c# object is enum 
Csharp :: linear search algorithm c# 
Csharp :: print hello world in unity 
Csharp :: unity mouse button names 
Csharp :: wpf keydown detect if control key is down 
Csharp :: serial begin 
Csharp :: browser folder in wpf 
Csharp :: write last line txt file c# 
Csharp :: if statement in razor using "?" and ":" 
Csharp :: C# Change color 
Csharp :: c# sort array 
Csharp :: remove all values from list c# 
Csharp :: How to execute script in C# 
Csharp :: save binary data to file c# 
Csharp :: DateTime restrictions 
Csharp :: list contains type c# 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =