I am using ASP.net Core 3.1 and trying to make appsettings.json inaccessible on the browser i.e. when I am typing https://myapp/appsettings.json, it's showing the contents of appsettings. I want to make it hide or block on the browser.
My solution explorer looks like this:
MyDeliveryWebSite
- Properties
- APIControllers
- Models
- Views
- appsettings.json
- Programs.cs
- Startup.cs
My url is: https://mydeliveryapp.cloudappp.net/appsettings.json. The output will be complete appsettings file content which I need to hide or block in the browser. I already tried many things. I am not sure if I am missing something out.
I am expecting the appsettings.json file should not be exposed publicly on the browser.





appsettings.jsonwithin views?appsettings.jsonwithin your controller? Otherthan, it shouldn't be exposed autometically. Please share more details.