Re: Intermittent Incorrect Result on System.IO.Directory.Exists

Chris Anderson <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.advanced
Message-ID <[email protected]>
> I'm getting an intermittent false negative on the call "if
> (!System.IO.Directory.Exists(folder))" in code in an ASP.NET 2 web
site
> [1].
> The folder clearly exists, and even contains a log file that is
written
> to
> when the CLR doesn't lie about the folder's existence.
> 

Check the permissions on the folder for the account ASP.NET is using.

System.IO.Directory.Exists() returns false if it has no rights to access
it (for that user it effectively does not exist 

It's implemented like that for security reasons..if it threw a security
exception or something, you'd be able to map out the filesystem by
simply guessing the names of files and folders even if you have no
rights


Chris

===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.