Sep 26

IIS Folder Permissions not inherited by files

Generally, when you assign specific access rights for particular Windows users to a web folder in IIS, you expect files created in that folder to automatically inherit those permissions. This work as long as the files are created directly in that folder. For eg.if you have an uploads folder where you upload files via FTP.

But it does not work in cases where files are not directly created in that folder. The best example being uploads. ASP.NET uploads are not directly created in the target folder; they generally get created in the Windows temp folder and then get moved to the destination folder. (A lot depends on the upload component used of course).

In such a case, files do not automatically inherit the permission of the destination folder they are copied to. They inherit the permission of the folders in which they are created. So if the temp folders does not allow anonymous access, then a file moved from the folder to eg. the uploads folder, will not allow itself to be accessed via the web anonymously. Most of the times accessing an uploaded file via a web page throws up a Authentication dialog box from the browser.

TheĀ  way around this is to set anonymous permissions to the temp folder (or whatever folder the file is getting created in first).

So if your IIS has a Guest user account named IUSR_XXXX then IUSR_XXX needs to have permissions on both the temp folder and the destination uploads folder.

Permissions

IMPORTANT: It is best not to fiddle around with default settings of the Windows temp folder. Better to create your own temp folder which will be used by your upload component.

 

 

Mar 11

Cannot view hidden files in Windows Explorer

The Problem

When you view files and folders using Windows Explorer, you are unable to see hidden files. Experienced users will go to the Tools->Folder Options menu and change the setting as shown below:

Folder Options window

Folder Options window

If you are able to see hidden files after this, then you dont need to read this article further. However, if you still are not able to see hidden files and you come back to the Folder Options window and find that the ‘Show hidden files and folders’ has reverted back to its unchecked state, then read further.

First Reaction

The most logical thing in such a case would be to check for viruses, trojans, spyware and malware. Use well-known free or paid virus scanners and anti-spyware tools. Hopefully, after cleaning, if you come back to the Folder Options window and check ‘Show hidden files…’, it should work.

Aarrgh! What the heck!

‘Show hidden files and folders’ has reverted back to its unchecked state? Again? To fix this, and assuming your system is not infected, you need to change two registry keys. To do this you need to have administrator rights.

Please note , this article assumes you are confortable with using the Registry Editor. Making a mistake while editing could send your Windows into disaster zone.

1.Go to the command prompt and load regedit.exe.

2.First go to the key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerAdvanced

FolderHiddenSHOWALL

3.In the right pane, the current value of CheckedValue would most likely be set to 2. Edit and make it 1.

HKLM key

HKLM key

4.Next go to the key:

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerAdvanced

5.In the right pane, the value of Hidden will be set to 2. Edit it to make it 1.

HKEY CURRENT USER

HKEY CURRENT USER

6.Close the registry editor and refresh Windows Explorer now. You should be able to see the hidden files and folders.