Yesterday, at the dotNed meeting, the question came up why running an .NET application from a network location, such as a share, doesn’t work and generates a Security Exception. It seems this question is raised every once in a while, so here’s a quick solution using caspol.exe. The reason for it being quick is mainly because caspol can be run from the command-line. Alternatively, you can use the Microsoft .NET Framework 2.0 Configuration Tool, or the Trust Assemblies Location property in Visual Studio (which is useful only during development.).
To grant full trust to a network folder
-
Type the following command in the Visual Studio Command Prompt:
caspol -m -ag LocalIntranet_Zone -url \\<ServerName>\<FolderName>\* FullTrust -n "<Name>" -d "<Description>"
[source]
Leave a Comment