I am faced with this strange problem:
In an .net web application, there is some code equivalent to this:
if (Directory.Exists("config"))
{ ... }
It basically checks to see if C:\Windows\system32\inetsrv\config directory exists, why the code is written like this is beyond me and this question.
What confuses me is the above code would return false on two servers and return true on others. (I expected it to return true all the time, since C:\Windows\system32\inetsrv\config is a system directory in Server 2008.)
Question: I want to know why on those two servers this statement would return false. Where should I look?
Restriction: I cannot change any code (obfuscated/signed assemblies), but I have full access to the servers.
Update: The answer is apparently quite simple… on those two particular servers someone deployed a newer version of the particular dll which behaves differently. Damn!
Take note of the following from the MSDN page
I would start by double checking that the user running the web app (from the app pool identity, impersonation, etc) has permissions to the directory.
You say you expect it to true but have you gone ahead and verified the directory truly exists?