From the msdn site, I know that the customErrors element provides information ab...">

Equivalent implementation for <customErrors mode = RemoteOnly / ">

From the msdn site, I know that the customErrors element provides information about custom error messages for ASP. NET RemoteOnly for the mode attribute indicates that user errors are displayed only to remote clients and that ASP.NET errors are displayed to the local host.

On the C # side, how can it be implemented that some logic calls only for remote clients, and the other for the local host (C # code that checks this condition will be called from the Global.asax.cs Application_Error level)?

+4
source share
2 answers

I have found a solution.

I was not aware that the HttpRequest type has the IsLocal property. I checked the build of System.Web using dotPeek to implement System.Web.Configuration.CustomErrorsSection . I found using the IsLocal property for RemoteOnly mode. Its value indicates whether the request is from the local computer.

 protected void Application_Error(object sender, EventArgs e) { if(Context.Request.IsLocal) { //do stuff } } 
+5
source

You can use a separate Web.Config for a specific folder and override the main web configuration value for this folder configuration file

0
source

Source: https://habr.com/ru/post/1401321/


All Articles