views:

30

answers:

1

Question: I have a web setup project.

It installs the webapp and puts it into the appropriate virtual directory.
So far so good.
My question now is: how do I set folder write permission?
My problem is, I can set the permissions programmatically, but I need to know the IIS user the application runs under, since it's that user that need the permissions.

How can I get (or set) the IIS user ?

A: 

The default value is usually IUSR_%machinename%

You could attempt to read the IIS metabase file but it's usually in a system folder (C:\WINDOWS\system32\inetsrv\metabase.xml). Find the <IIsWebService> element with the proper Location attribute and then read the value of the AnonymousUserName attribute. I don't recommend writing directly to the metabase.

I am only familiar with IIS6 so the above may vary by version.

Hugh Jeffner
Yes, and I use IIS7 and there is no attribute AnonymousUserName in there...
Quandary