[英]How to restrict json files that are stored under wwwroot folder to view from Web Browser
I have a " client-styles.css " in my wwwroot / client_folder folder.我的wwwroot / client_folder文件夹中有一个“ client-styles.css ”。 When I run my project in localhost and give that css file path in the browser its showing the entire css file in the web browser.当我在 localhost 中运行我的项目并在浏览器中提供 css 文件路径时,它会在 web 浏览器中显示整个 css 文件。 ( localhost:5000/client_folder/client-styles.css ). (本地主机:5000/client_folder/client-styles.css)。
In the same way I have a folder also contains json files which contains sensitive information and those are also showing if we give the path to those Json files ( localhost:5000/client_folder/client-secrets.json ) in the browser.同样,我有一个文件夹还包含json 文件,其中包含敏感信息,如果我们提供这些 Json 文件的路径,这些文件也会显示(localhost:5000/client_folder/client-secrets.Z466DEEC76ECDF5FCA6D35 中的浏览器) Is there any way restricting some files to view from web browser.有什么方法可以限制某些文件从 web 浏览器查看。
Thanks谢谢
Based on your last comment above:根据您上面的最后评论:
It's perfectly acceptable to store css and javascript files in wwwroot.将 css 和 javascript 文件存储在 wwwroot 中是完全可以接受的。 However, do not store anything secret there.但是,不要在那里存储任何秘密。 Storing secrets like connectionstrings are best in EnvironmentVariables.在 EnvironmentVariables 中最好存储连接字符串之类的秘密。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.