When execution reaches my 'throw new UserFriendlyException("string")' line, it throws an actual exception rather than showing as a dialog as it used to do before i upgraded my project to Pro and .NET 9:
I assume there is some misconfiguration here, but I can't find it in any documentation online. Please show me how I can get back to having this display to the user in a dialog.
9 Answer(s)
- 
    0- In ABP MVC applications, throwing a UserFriendlyException should display a user-friendly dialog instead of the raw exception page. If you are seeing the raw exception after upgrading to .NET 9 or ABP Commercial Pro, it is likely due to a missing or misconfigured exception filter or middleware. 
- Ensure you have the AbpExceptionFilter enabled in your MVC pipeline. In your Startup.cs or module configuration, make sure you have: - services.AddAbpMvcExceptionHandling();
- Also, check that you are not running in the Development environment, as the Developer Exception Page will override ABP's user-friendly dialog. In production, ABP's exception handling will show the dialog. 
- If you have custom error handling middleware or filters, ensure they do not interfere with ABP's exception handling. 
- For more details, see the official documentation: - https://docs.abp.io/en/abp/latest/Exception-Handling#user-friendly-exception
 
 
 This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon. 
- 
    0I don't see services.AddAbpMvcExceptionHandling();in my WebModule.cs, so I was looking to add it, but I doesn't seem to be available to add under context.services in the ConfigureServices method. I think I am still missing something here.If you need access to my project, it was emailed for a previous ticket: 9542. 
- 
    0this is development page for errors, try to run it in release mode also environment variable = release 
- 
    0Would you mind spelling this out for me a bit more? Is this the ASPNETCORE_ENVIRONMENT variable, or another one? I tried experimenting with utilizing app.UseErrorPage() in dev rather than app.UserDeveloperExceptionPage(), and that didn't seem to do anything. It's very possible I am grossly misunderstanding how to go about this, but any advice would be appreciatd. 
- 
    0
- 
    0Thanks for pointing that out. I do have that configured, but it is also failing in production as well (this error only arises when I throw a UserFriendlyException shown below):  Here is my OnApplicationInitialization method: Here is my OnApplicationInitialization method:It is throwing the 500 error when it hits this line:  I didn't change anything here other than upgrading to Pro, so I think something must have gone awry (which wouldn't be surprising since I had other issues after upgrading). I don't think it should be throwing a 500 error when I throw a UserFriendlyException. 
- 
    0hi You can add try catchwhen calling the application service in yourrazor page. Because yourpagereturn type ispage(IActionResult)instead ofobject.public virtual async Task<IActionResult> OnPostAsync() { try { await AppService.... } catch (UserFriendlyException e) { Alerts.Danger(L["Your messag"]); return Page(); } }Thanks. 
- 
    0Ok, it seems like maybe in the past when I was getting the user friendly exception dialog, it was because I was using an AJAX request. Using try-catch in the razor page model should allow me to get close to what I need. Thanks. 
- 
    0Great 




 
                                