English 中文(简体)
如何防止向未经认证的用户下载文件
原标题:How to prevent download of files to unauthenticated users

我有一个用户使用表格认证登录的网站, 并有一个文件夹路径, 我不想让任何未经认证的用户( 那些未登录的用户) 下载文件。 我如何执行此操作?

谢谢

萨钦

最佳回答

您可以通过配置完成此操作, 见< a href="http://msdn.microsoft.com/ en- us/library/8d82143t.aspx" rel=“ nofollow” >http://msdn.microsoft.com/ en- us/library/8d82143t.aspx

<location path="Files">
   <system.web>
     <authorization>
       <deny users="?"/>
     </authorization>
   </system.web>
</location>
问题回答

您可以让函数下载( 在服务器侧面), 在那里您将检查当前登录, 然后将路径发送到文件, 供可访问的人使用 。

这里您可以看到其他方法 < a href=" "https://stackoverflow.com/ questions/5310774/ how-to-stop-user-not-get-files-if-not-login">get-files-if-login

将文件放置到授权文件夹中。 这样如果未经授权的用户来到该文件夹, 他们将被重定向到登录页面以获得授权 。





相关问题
Session Management with Windows Authentication

In an ASP.NET web app, using Integrated Windows Authentication, is the session tied to the windows identity? In other words, if I login (using IWA) to the app, and the app stores some "stuff" in my ...

Using Elmah with Cassini

Does anyone know if I can use Elmah with Visual Studio build-in web server(aka Cassini)? I get it working easily on IIS, but using same configuration, it doesn t work with Cassini. When I requested ...

Setting hostname in IIS, include www?

I want to set the hostname for a website I m adding in IIS 7, however do I include the www in the hostname or not? because I want both www.mysite.com and mysite.com both to point to mysite on the ...

inetpub versus any other folder

I ve run websites out of inetpub, as well as from folders just residing on the C: drive. I wonder, are there any definitive advantages to running websites out of inetputwwwroot?

IIS 6.0 hangs when serving a web-service

I am having issues with one of our web-services. It works fine on my development machine (win XP) whether I host it as a separate application or using cassini from Visual studio. Once I deploy on the ...

热门标签