Microsoft.Web.Administration VirtualDirectory 权限
我可以在下面所示的代码中使用 Microsoft.Web.Administration dll 轻松地在 IIS7 中创建虚拟目录,但我一直在绞尽脑汁地试图找出如何授予“网络服务”写入权限虚拟目录创建后。有人能指出我正确的方向吗?
Private Sub CreateVirDir(ByVal WebSite As String, ByVal AppPath As String, ByVal VirPath As String, ByVal DirPath As String)
Dim sm As New Microsoft.Web.Administration.ServerManager()
Dim cpapp As Microsoft.Web.Administration.Application = sm.Sites(WebSite).Applications(AppPath)
cpapp.VirtualDirectories.Add(VirPath, DirPath)
sm.CommitChanges()
End Sub
I'm able to create a Virtual Directory in IIS7 using the Microsoft.Web.Administration dll pretty easily in the code shown below but I've been pulling my hair out trying to find out how to give "Network Service" write permissions to the Virtual Directory once it's been created. Can anyone point me in the right direction?
Private Sub CreateVirDir(ByVal WebSite As String, ByVal AppPath As String, ByVal VirPath As String, ByVal DirPath As String)
Dim sm As New Microsoft.Web.Administration.ServerManager()
Dim cpapp As Microsoft.Web.Administration.Application = sm.Sites(WebSite).Applications(AppPath)
cpapp.VirtualDirectories.Add(VirPath, DirPath)
sm.CommitChanges()
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设这是 NTFS 写入权限,则您不会对虚拟目录本身应用写入权限。您需要在虚拟目录指向的文件夹上应用此权限。
您可以使用以下命名空间以编程方式设置 NTFS 权限:
以下链接包含演示如何操作 NTFS ACL 的示例代码:
Assuming this is NTFS write permissions, you don't apply write permissions on the virtual directory itself. You would need to apply this permission on the folder that the virtual directory points to.
You can use the following namespaces to programmatically set NTFS permissions:
The following link has example code that demonstrates how to manipulate NTFS ACL's: