In the try catch block want to get the catch exception code, we know that 404: not found, 400: bad request. In my catch block want to get exception code. How to get exception code in C# catch block.
try
{
await next(context);
}
catch (Exception ex)
{
}