HI : How change userfriendlyexception statuscode to 200,or override userfriendlyexception ?
thanks!
product version:10.3 product type:mvc framework type:.net core ABP Framework version:6.3
-Which theme are you using? Metronic
- What are the theme settings?
- Default
2 Answer(s)
-
0
Hi @langwen
Here is the place that abp filter http result: https://github.com/aspnetboilerplate/aspnetboilerplate/blob/f887d7b798cda557701983a44f285d30062ddf1e/src/Abp.AspNetCore/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs#L66 You can override it to return 200 if exception is UserFriendlyException. It is an action filter. You can follow that documentation to get more info about it. https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters?view=aspnetcore-5.0 You will need to remove our filter than implement your own filter. You may follow that code:
var abpExceptionFilter = options.Filters.First(f => f is AbpExceptionFilter); var currentOrderOfFilter = options.Filters.IndexOf(abpExceptionFilter); options.Filters.Remove(abpExceptionFilter); options.Filters.AddService(typeof([YOUREXCEPTIONFILTER]), currentOrderOfFilter);
-
0
HI @musa.demir Thank you, according to your method, my functional requirements have been achieved