To emulate my hosting provider, I have set up my local IIS in Windows 7 to run Medium Trust. Microsoft say that, in Medium Trust, you have restricted FileIOPermission. This seems to be correct because I have the following entry in my \Windows\Microsoft.NET\Framework\v4.0.30319\Config\web_mediumtrust.config file:
I am trying to discover if a sub-directory exists in my application's root folder. I would have thought this would be okay, since I have PathDiscovery permission, but when I try the following:
DirectoryInfo logFileDirectoryInfo = new DirectoryInfo( @"\logs" );
I get a security exception, which simply says I do not have FileIOPermission.
Can anyone tell me what I am doing wrong? Is there another way to check if a sub-directory exists without causing this exception?
Any help or advice would be very much appreciated.
Kind wishes, Patrick