我需要阻止某人直接访问pdf,而只是允许他们通过应用程序本身.如何才能做到这一点?
解决方法
查看我的博客文章:
How to hide users files and folders on your website?
How to hide users files and folders on your website?
There are two solutions for doing that:
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- Stop IIS from serving this folder:
IIS by default doesn’t server some website folders and files such App_Data,App_Code,bin,App_GlobalResourses,App_LocalResources,Web.config,….