HAHOOS
HAHOOS
CC#
Created by HAHOOS on 2/20/2023 in #help
Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by...
Hello, I am working on an API in MVC and I want throw an exception, but I get the following error:
Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.
I don't know what to do, I looked everywhere on the internet and nothing, here is my code for executing an error:
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(JsonConvert.SerializeObject("Code has been not found"), Encoding.UTF8, "application/json"),
ReasonPhrase = "Code Not Found",
};
throw new HttpResponseException(resp);
var resp = new HttpResponseMessage(HttpStatusCode.NotFound)
{
Content = new StringContent(JsonConvert.SerializeObject("Code has been not found"), Encoding.UTF8, "application/json"),
ReasonPhrase = "Code Not Found",
};
throw new HttpResponseException(resp);
17 replies