问题描述
我需要prevent有人直接访问PDF文件,而不是只让他们通过应用程序本身来拉动。如何才能做到这一点?
I need to prevent someone from directly accessing a pdf, instead only allowing them to be pulled through the app itself. How can this be done?
推荐答案
检查我的博客文章这一点:
Check my blog post about this:How to hide users files and folders on your website?
有做这两种解决方案:
1 - 你可以把你的UsersUploads文件夹中的网站外
目录中,所以如果你的网站上存在C:\\网站\\ example.com你
可以把UsersUploads有C:\\ UsersUploads,像IIS有
这个文件夹上,并没有控制它的文件,和你的网站code会
仍然可以访问这个目录作为一个正常的物理路径。
1- You can put your "UsersUploads" folder outside the website directory, so if your website exist on "c:\website\example.com" you can put the "UsersUploads" there "c:\UsersUploads", Like that IIS has no control over this folder and its files, And your website code will still have access to this directory as a normal physical path.
2 - 停止IIS服务,从这个文件夹:
2- Stop IIS from serving this folder:
IIS默认情况下并不服务器的一些网站的文件夹和文件等
App_Data文件,APP_ code,垃圾桶,App_GlobalResourses,App_LocalResources文件,
Web.config中,...。
IIS by default doesn’t server some website folders and files such App_Data, App_Code, bin, App_GlobalResourses, App_LocalResources, Web.config,….
这篇关于拒绝到一个文件夹直接访问(只允许通过应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!