How can we change the response code returned from a UserFriendlyException? Because it is throwing an exception it returns a 500 response code which our web application blocks what is returned from that so that no sensitive server errors are returned.
4 Answer(s)
-
0
Hi, can you share the project framework and version?
if you are changing for some of the
UserFriendlyException
only. You can pass the status code in theUserFriendlyException
constructor -
0
Oh sorry yes, It is Angular, ASP.NET Core project on version ASPNet Zero 6.6.1. I am currently in the process of upgrading to 6.8
I did not know you could do that. Is there documentation on that?
-
0
Hi, there is documentation on exception handling which probably suits your use case.
See https://aspnetboilerplate.com/Pages/Documents/AspNet-Core#exception-filter
You can also refer to the apporach mentioned in this thread for some code examples.
https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3280
-
0
Thank you. This helped a lot