asp.net – 拒绝直接访问文件夹(仅允许通过应用程序)

前端之家收集整理的这篇文章主要介绍了asp.net – 拒绝直接访问文件夹(仅允许通过应用程序)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要阻止某人直接访问pdf,而只是允许他们通过应用程序本身.如何才能做到这一点?

解决方法

查看我的博客文章
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,….

原文链接:https://www.f2er.com/aspnet/251897.html

猜你在找的asp.Net相关文章