skip to Main Content

Asp.net – The value '' is not valid for

I have a Blazor web application which uses System.ComponentModel.DataAnnotations attribute for validation in a registration form. I have a property named NationalCode which is nullable long I did not added [Required] attribute above my NationalCode property But when I want…

VIEW QUESTION

Json – What's the best way to get result from ReadAsStringAsync response?

What I have This code calling my API: HttpResponseMessage response = await Http.GetAsync("https://localhost:7094/api/MyResource/94d0e5ca-2be7-42f7-94dc-13955c11595c"); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine($"RESPONSE: {responseBody}"); var payload = JsonSerializer.Deserialize<MyClass>(responseBody); var json = JsonSerializer.Serialize(payload); Console.WriteLine($"PAYLOAD: {json}"); This code is called from OnInitializedAsync in a NET8…

VIEW QUESTION
Back To Top
Search