I have a simple file selector on my web application which uses Directory.GetFiles and Directory.GetDirectories to produce the UI. This works perfectly on my localhost, but when I upload it to my Windows Server 2003 hosting I can only see files - on the same directory, GetFiles works but GetDirectories doesn't.
The code is incredibly simple - the string dir is created by a Server.MapPath call, and then:
List<string> dirs = Directory.GetDirectories(dir).ToList();
List<string> files = Directory.GetFiles(dir).ToList();
I have tried everything I can think of security-wise; even to the point of giving "Everyone" full access to all directories in the web root, and even this makes no difference.
So if the issue is not with security, I would be very grateful of some suggestions for more things to try!
Update: I'm pretty dumb - the code that spat out the HTML contained some very old testing code that hadn't made any difference on local so hadn't been noticed and removed, but that caused every directory on the server to be ignored! What was it?
if (!subDir.Contains(".")) { ...
On the server, all sites are in folders named by their domain - on local, they aren't. Me == stupid. Sorry everyone!