Stacktrace information is displayed in a non-development environment.
1public void StackTraceExposureNoncompliant(IApplicationBuilder application, IHostEnvironment environment)
2{
3 if (!environment.IsDevelopment())
4 {
5 // Noncompliant: Stacktrace information is displayed in a non-Development environment.
6 application.UseDeveloperExceptionPage();
7 }
8 else
9 {
10 application.UseExceptionHandler("/Error");
11 }
12}
1public void StackTraceExposureCompliant(IApplicationBuilder application, IHostEnvironment environment)
2{
3 if (environment.IsDevelopment())
4 {
5 // Compliant: Stacktrace information is displayed in a Development environment.
6 application.UseDeveloperExceptionPage();
7 }
8 else
9 {
10 application.UseExceptionHandler("/Error");
11 }
12}