The .NET security model throws security errors whenever a .NET exe is run from a file share. The error does not appear when ran from a local drive. Does anyone know of a way around this without requiring the code to be signed?
7 Answers
Using CasPol to Fully Trust a Share
more answers here:
Why does my .NET application crash when run from a network drive?
- 1
- 1
- 51,744
- 26
- 128
- 170
Use caspol.exe to assign that file share enough permissions to run your program.
- 8,520
- 1
- 29
- 35
You might be able to build the application against .net 3.5 sp1 this version was removing this security setting.
- 20,853
- 18
- 75
- 116
To get around this we ended up wrapping our .exe in a batch file. The batch file copied the .exe to the local drive and ran it from there. I'm sure there is a less hacky way though!
- 1,798
- 1
- 18
- 25
Make sure that .Net 3.5SP1 is installed on the machine which is running the software. This version removes the security restriction on apps running from a file share. It allows them to run at full trust vs. the previous model which put them in a restricted environment.
Here's a link to Vance's blog article on the subject
- 733,204
- 149
- 1,241
- 1,454
You can use the .Net configuration wizard to loosen security for the specific Assembly and it's location, this in turn can be deployed through a group policy. You can also use caspol as earlier mentioned.
The other alternative is to use code access security. There is a brilliant MSDN article here explaining it.
The third alternative is using clickonce deployment, however this still creates a local instance of the assembly when executed.
- 29,219
- 2
- 37
- 44
-
For .NET 2.0 the configuration wizard is part of Visual Studio and can be found at "c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\mscorcfg.msc" – Wim Coenen May 03 '09 at 00:08
You can use Click Once deployment to deploy your application from a file share.
- 44,864
- 6
- 88
- 112