开发者

How to get the user a webapplication will run under?

开发者 https://www.devze.com 2023-01-07 10:06 出处:网络
Question: I have a web setup project. It installs the webapp and puts it into the appropriate virtual directory.

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 I开发者_如何学CIS user ?


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.

0

精彩评论

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