简体   繁体   English

ASP / ASP.NET处理写入权限的最佳方法?

[英]ASP/ASP.NET Best way to handle write permissions?

Say you have public ASP.NET (and Classic ASP) applications on IIS with a script/page that needs to write or update html files in a specific folder that is located within the web publishing folder tree. 假设您在IIS上具有公共ASP.NET(和Classic ASP)应用程序,并且该脚本/页面需要在Web发布文件夹树内的特定文件夹中写入或更新html文件。

What is the proper way to handle this and exactly how do you do it? 处理此问题的正确方法是什么?究竟该如何做? (ie set directory permissions in IIS or windows explorer) (即在IIS或Windows资源管理器中设置目录权限)

My main concern is that I want to let the ASP/ASP.NET apps write to a folder, but I don't want regular http users to be able to put files into it directly via HTTP PUT. 我主要担心的是,我想让ASP / ASP.NET应用程序写入文件夹,但我不希望普通的http用户能够通过HTTP PUT直接将文件放入其中。

You'll want to set your NTFS permissions as follows: 您将需要如下设置NTFS权限:

  • IUSR_ <MachineName> - The anonymous user should only have READ access IUSR_ <MachineName> -匿名用户应仅具有READ访问权限
  • Network Service (or App Pool identity) - READ and WRITE access 网络服务(或应用程序池标识)-读取和写入访问

With these permissions, you can most likely safely remove the Everyone and Authenticated Users accounts from the ACL as well. 有了这些权限,您很可能也可以安全地从ACL中删除“所有人”和“认证用户”帐户。

More info: 更多信息: http://support.microsoft.com/kb/815153 http://support.microsoft.com/kb/815153

Don't enable writing in IIS--that only speaks to HTTP PUT, not underlying filesystem permissions. 请勿在IIS中启用写入功能-仅与HTTP PUT对话,而不与基础文件系统权限对话。 Then do what gattaca said. 然后按照加塔卡所说的做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM