tags:

views:

185

answers:

3

I'm getting a FileIOPermssion exception thrown when trying to create a folder in Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) on some computers. I've established that there is some form of antivirus running on the computer in question, but I haven't been able to get in contact with their IT department to find out what specifically they are using.

Has anyone else run into an issue an issue like this? I've tried googling for a while and haven't come up with anything. Is there something I need to do to guarantee write permissions to the ApplicationData?

A: 

Vista or XP. Or more importantly, no problems on XP, but problems on Vista? You might be running afoul of UAC which is more stringent about checking the security permissions required for various actions. I ran into a similar problem with a printer set up program I wrote -- works fine on XP, but requires strong-naming and some GPO tweaks when run from network share in Vista.

EDIT: Since that doesn't seem to be the problem you might check whether they have folder redirection turned on and, if so, how it is configured. It might be an issue with writing to a network share rather than local disk. Or perhaps there is a GPO that blocks write access to the ApplicationData folder -- or software installation in general.

tvanfosson
+1  A: 

I received another answer on a different forum that might be the answer but I've got to verify it first. Basically what they suggested is that the user might have installed the app on a network share instead of directly on the harddrive which would mean the application wouldn't run with full trust. The recommended fix was to use isolated storage instead of ApplicationData if that was the case.

I'll verify that this is the problem and update if using isolated storage resolves it.

Timothy Strimple
A: 

The problem was definitely caused by running the application off of the network drive. This put the application into Partial Trust which is preventing writing to the ApplicationData directory. Isolated Storage was supposed to work around this but I haven't had any luck with it either. It produces the exact same error as using other File IO commands directly.

One thing that DOES work is to install the .NET 3.5 framework which changes the default trust level for applications running on network shares.

Timothy Strimple