Doesn’t ASP.NET Core have an InternalServerError()?

ASP.NET Core 2.x doesn’t have InternalServerError method. Instead you can include the following library.

using Microsoft.AspNetCore.Http;

And then use the following code.

return new StatusCodeResult(StatusCodes.Status500InternalServerError);

Or if you want to add the exception along with the response, try the following code

var result = StatusCode(StatusCodes.Status500InternalServerError, exception);
return result;    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)