Asp.net site prevents a folder or file from being accessed by the browser. asp.net site
There is a Config folder under the root directory of a site, which contains some txt text in json format. text is a static resource. If you know the address of this text, you can enter the address in the browser to open the text, and others can see the site configuration, which is not expected, so you need to make this folder disabled by the browser.
Method 1: Change *. txt to *. config. asp.net cannot access files with. cs,. config, and other suffixes by default. Note: Add a config file to vs and write the required configuration content. This mode is recommended. Method 2: 1 using System; 2 3 namespace System.Web 4 { 5 internal class HttpForbiddenHandler : IHttpHandler 6 { 7 public bool IsReusable 8 { 9 get10 {11 return true;12 }13 }14 15 internal HttpForbiddenHandler()16 {17 }18 19 public void ProcessRequest(HttpContext context)20 {21 PerfCounters.IncrementCounter(AppPerfCounter.REQUESTS_NOT_FOUND);22 throw new HttpException(403, SR.GetString("Path_forbidden", new object[]23 {24 context.Request.Path25 }));26 }27 }28 }