I have an AspNet Core web application, in which I want to show custom errors only when someone is accessing the application remotely. In case this application is being accessed locally ,i want to keep the detailed error page for the developer. In .netFramework 4.x and earlier, we were able to specify this in web.config customErrors property with mode=RemoteOnly. I am aware about the fact that we can make user of ASPNETCORE_ENVIRONMENT variable to turn on custom error or developer exception page in aspnetcore. But what I am looking for is -to have similar functionality for CustomErrors mode = RemoteOnly in AspNetCore.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
To answer your question directly, I don't believe there is an straight forward replacement for CustomErrors key in the Web.config. However, there are a few more methods available on the IHostingEnvironment interface that may be of use for you depending on what you're trying to implement. For example you could check multiple environments:
There is decent documentation on different ways to implement environment specific features here.