对文件的访问受到限制
我读到,如果你想给你的用户一个没有人可以通过 url 访问的文件,你需要将它放在域上层的目录中。
在我的计算机上它可以工作,但是当我在线尝试时,我得到的是domain.com,之后我需要将文件夹提升2级,
正确的方法是什么?
i read that if you want to give your users a file that nobody can access via url, you need to put it in a directory in an upper level of the domain.
on my computer it worked but when i have tried that online what i got is the domain.com and after that the folder that i needed to be 2 levels up
what is the right way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
服务器上与 Web 根目录相关的文件在哪里?例如,如果您的 Web 根目录是 C:\inetpub\wwwroot\MyApplication\,那么您需要将文件放在该目录之外(否则,它们会像任何其他文件一样共享)。然后,在 ASP 代码中,您将通过在代码中读取该文件并将其输出给有权访问该文件的用户来控制对该文件的访问。
听起来你说你已经在本地机器上运行了后一部分,是这样吗?服务器上到底是怎么失败的?
Where are the files on the server in relation to the web root? For example, if your web root is
C:\inetpub\wwwroot\MyApplication\
then you'll want to put the files outside of that directory (otherwise, they're shared like any other file). Then, in your ASP code, you'll control access to that file by reading it in the code and outputting it to users who are permitted to access it.It sounds like you say you have that latter part working on your local machine already, is that the case? How exactly is it failing on the server?
如果您不希望任何 URL 都可以访问它,则根本不要将其放入您的 Web 服务器域中。如果您希望仅某些人可以访问它,那么您需要研究某种身份验证/授权技术。
If you don't want it accessible by any URL from any one, then don't put it in your web server domain at all. If you want it accessible by only certain people, then you need to look into some kind of authentication / authorization technique.