I am trying to display error messages in locale language and for all handled exceptions my team is using resource file to display in local language but Is there a way to intercept the middleware to display application unhandled exceptions in locale language?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- Dotnet Core API - Get the URL of a controller meth
- Why am I unable to run dotnet tool install --globa
- parameters in routing do not work MVC 3
- Can I use MvcJsonOptions configured during Startup
相关文章
- How to get a list of connected clients on SignalR
- DotNet Core console app: An assembly specified in
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- EF Core 'another instance is already being tra
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
Near the start of our app we have a line of code that looks similar to
and this seems to catch errors.
We also have a catch-all route at the end of our route tables that looks a bit like
where we call the same code. You can check the Accept-Language header to make your best guess at what locale your caller might be able to use. Re-post a specific question if you need help with that aspect.
Standard .NET exceptions are localized and message language will depend on current thread culture. So for you to make it work you'll need to implement RequestCultureMiddleware that would change the language based on your needs. Here is an example:
Register it before MVC in
Startup
class:Please note: displaying exception message is not covered here.