IIS Application Pool User AppData folder doesn't contain a TEMP folder - iis

I try to host a website that needs the user profile tempfolder due to a requirement to load the User Profile
The User folder created in Users contains an AppData folder, but that in turn doesnt contain a TEMP folder
I tried to add the folder before the deploy, but then the profile folder doesnt exist, and it creates another folder for the profile when it tries to start
One workaround would be to trigger a call which creates the User profile folder, and then add it
But i would like to know if there are any better/cleaner option to do it?

The issue was with my previous sysprepping of the machine, my script ran it as the system account, and that caused a lot of funky behavior!

Related

How do you allow IIS to access a symlink folder?

I have a two webservers, on each webserver in the C:\inetpub\logs\LogFiles I have created a symbolic link to the other servers log file folders, so essentially I can be logged in to one of the webservers and see the logs on both servers in one place. This works perfectly.
I am building a webpage to make the log files available via a webpage, the code simply goes to the C:\inetpub\logs\LogFiles directory and lists the files in each sub folder, i.e. W3SVC1 (the local folder) and webserver2-w3svc1 (the remote log folder).
For the local folders it works fine, but I am getting the "access denied" error when trying to call Directory.GetFiles on the symlinkd folder. I suspect this is some sort of permissions error, but I tried giving the symlinkd folder full permissions to "everyone" but I still get the same error.
Is this something to do with the fact that when I created the symlinkd I had to enter the username and password of the webserver2, and these credentials cannot be accessed/used by IIS when trying to get access to the folder?
Is there anything I can do allow IIS to access the contents of this symlinkd folder?
I don't think you need to use a symlink, you can create a virtual directory mapping to that directory in IIS, just map it to the target path. In IIS, right click on the website and select Add Virtual Directory.
For more information, please refer to this official document.
After much experimentation, the only way to do this is as follows:
Create a new user on the computer.
Run the AppPool in IIS under this new users' identity as opposed to the default IUSR account.
Give the folder you are sharing permissions to this user AND 'share' this folder with the new user.

IIS - proper permissions to create folders in Root

I have a web app that creates a temp. folder in the website root, writes some files into it, and then zips the folder. Everything works fine on my machine. I had to add two extra users to make it work. IUSR and IIS_IUSRS - Both with a full access. The QA persion is reporting that she is getting an error. What I see happening is that no temp. folder is created, however, the zip is altghough with wrong files inside. Can some one please explain is there a difference in permissions to create a file and create a folder?
Thanks

Windows userprofile folder showing different items depending on how it's accessed

I was recently cleaning up my %USERPROFILE% folder, this included deleting the documents and pictures folders from the OneDrive folder, changing some registry entries, etc.
However, Now when I go to my userprofile folder via the pinned link in Quick Access I do not see my Documents folder, but when I got to the userprofile folder through C:\Users\user it is there. If I type C:\Users\Username\Documents in search, I also reach the right folder.
The problem persists after refreshes of file explorer and after restarts.
Image of folder through quick access shortcut
Image of folder through manual navigation
Image of registry keys I edited
I was able to fix the problem by deleting some other registry values pointing to (the non-existent) %USERPROFILE%/OneDrive in:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell
Folders

How can I set permission to all new sub directories on windows server created by java?

I have a website hosted on IIS and I created a virtual directory ("pictures") which physical path is "C:/mydir/mysubdir". Inside "mysubdir" there are many sub-directories (for example: "123", "456" and so on ) containing images that are shown on the website with a regular html tag.
Until now everything is working fine and images are shown, the problem occurs when the back-end application hosted on Tomcat installed on windows server and connected to IIS goes to create new sub-directory under the physical path, the images inside the new folder are not shown due to an Unauthorized access 401, the work around I'm doing is set share permission all the times the user is creating new sub-directories via webapp but you can understand that is not possible do this all the time, this must work alone.
I already set all read/write permission to the Administrator account, even shared the parent folder and set the inheritance but is not working.
The owner of the folder is different if create from tomcat (LOCAL USER instead of Administrator) and I don't know if this could be a problem.
Please help me to find a solution.
Thanks in advance.
You could try the below steps to resolve the issue:
1)select your folder under which the new subfolder is creating by another user.
2)Right-click on the target folder/file and select Properties.
3)Security → Advanced.
4)click on the add and add user application pool identity(IIS AppPool\ (eg: IIS AppPool\smartcrypt)), iis_iusrs, and iusr.
5)by clicking on show advance permission set full control. and in applies to make sure it set to this folder, subfolders, and files.
6)click on and apply the setting.
7)in application pool identity set one of these network services, local system or application pool identity.

Getting Application Data folder for every user

In my application, every user has its own settings, that I save to a subdirectory in that user's Application Data directory. During uninstall, I want to delete those settings for every user on the computer. How can I do that in Inno Setup?
In other words, I need to get a list that contains Application Data directory for each user (not the shared Application Data directory), so that I can delete the MyAwesomeApp directory from there. Is there some way to do that?
You can't, due to the design of Windows.
The same design stops you accessing the profile folders too.
On top of this, it's accepted best practice to leave the user's data behind in case they want to reinstall it, roaming profiles, etc.
Assuming that your uninstaller runs with administrator priviledges, you can just get the User directory and then enumerate all the user directories there.
You can run an executable from Inno Setup written in whatever language you want. In it you can first get the current user's Application Data directory, using the SHGetSpecialFolderPath function. It would look something like this for Win7:
c:\Users\MyUser\AppData\Roaming\
You can use GetUserName to get the user's name (MyUser in this case), and find the parent directory and split the string to the parent directory "C:\Users\" and "AppData\Roaming\". You can then use FindFirstFile/FindNextFile to enumerate all users directories, and just append the second part "AppData\Roaming\" to them, and check if the file exists. By splitting the directory you get from SHGetSpecialFolderPath you ensure it would work both in XP (which would return something like C:\Documents and Settings\MyUser\Application Data") and in Win7. Basically you just replace MyUser with all the users' names in the string returned by SHGetSpecialFolderPath.
I have no idea if this avoids OS security or if it works with roaming users.

Resources