I have multiple applications on a IIS server. How can I set one particular application to run as user 'appuser' and all uploaded files to be saved by as this user. ASP.NET
1 Answers
Every single IIS application run under some so-called application pool. The application pools have default identity (App Pool Identity in newer IIS, NETWORK SERVICE in older IIS). You can also set application pool to have custom identity by specifying user credentials.
However it seems like an overkill to run application under specific user if the only thing you require is to set specific owner for files being created - so I'd rather just force file owner after the file was created instead of changing application pool identity.
See Getting / setting file owner in C# how to do that.
UPDATE
If you have to write to folder which is restricted to (yourspecialusername) I recommend this approach:
1) Dump file to temp files folder
2) Copy your file to shared folder under the (yourspecialusername) - see - Start a .Net Process as a Different User
3) Wait for Process in 2) to exit and delete temp file

- 1
- 1

- 21,349
- 5
- 54
- 89
-
I have a shared folder with write access only to this user. I cannot save anything inside the folder. – Pavel Sep 26 '16 at 13:57