views:

335

answers:

2

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 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.

+1  A: 

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.

naivists
A: 

Thank you for the answer. It did help me give myself permission to use getobject, now if I could only figure out how to write the thing I would be set.

Bryan