开发者

Change script execute permissions of a directory in IIS6 dynamically thru ASP

开发者 https://www.devze.com 2022-12-16 01:29 出处:网络
This is kind of an advanced problem, hopefully one of you asp/VB gurus will have a suggestion. I am trying to dynamically set a folder\'s execute permissions in IIS6 from an asp page. I have given the

This is kind of an advanced problem, hopefully one of you asp/VB gurus will have a suggestion. I am trying to dynamically set a folder's execute permissions in IIS6 from an asp page. I have given the server full permissions to make the changes necessary. When I run the code I get:

Microsoft VBScript runtime error '800a0046'

Permission denied: 'GetObject'

/learning.asp, line 11

I have a开发者_JAVA百科 server setup with IIS6 running a couple asp websites. I use a code like this to create a folder called "files"

set fso = Server.CreateObject("Scripting.FileSystemObject")

set folder3 = fso.CreateFolder(Server.MapPath(username & "/files"))

set folder3 = nothing

set fso = nothing

Works fine and creates the files folder just where I want it. However, the new folder has execute permissions set to "scripts and exe's" and I need it to be "never" or false. There is a system object that you can call to make this change, and I even have a piece of code that I wrote after reading another tutorial.

It doesn't work and gives the above error. I think, maybe, I am just leaving something out, but this stuff is a little over my head. Here is what I used, but I don't know the syntax or what exactly to call.

Set root = GetObject("IIS://localhost/" & username)

Set newVDir = root.Create("IIsWebVirtualDir","files")

newVDir.Path = "e:\iis3\server2\ADSI"

newVDir.AccessScript = False

newVDir.SetInfo

I have searched around for 3 days trying to find a solution to this, but not very many people do this type of thing apparently, because there are no posts about it that I can find.

Anyway, I don't understand what the getobject is supposed to do, and what newVDir.path I am supposed to be using?

Thank you, in advance, for any helpful suggestions you may have.


This article (see http://technet.microsoft.com/en-us/library/bb742439.aspx) explains what the GetObject actually does.

I believe, what happens behind the scene is that a COM object of type "IIS Admin Service" is (needs to be) created to perform your operations. By default, the IIS application pool account is not allowed to create such object. So maybe its worth to check it. Open Control panel->Administrative services, run "Component services". Find "my computer" in the tree and there find "IIS admin service". Check "activation" and "launch" permissions, add some if necessary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号