In such scenarios it is very difficult to configure 'Code Access Security' to selectively give FullTrust to particular locations. Also, reconfiguring CAS can become cumbersome as it has to be done on all machines over the network from where it's intended to run the application.
Whenever such a code is executed from intranet location that needs higher previleges provided by default by 'Local Intranet Permissions', the application throws SecurityException.
Configuring FullTrust for all the applications running from within Intranet Zone:
1. Give FullTrust to the 'IntranetZone' under Machine level security configuration:
1. If you are using .Net configuration wizard MMC available in Control Panel - Administrative Tools, then you can go to '.Net framework configuration' - My Computer - Runtime Security Policy - Machine - Code Groups - LocalIntranet_Zone. In right pane click on 'Edit Code Group Properties'. In the Property Page go to 'Permission Set' and select FullTrust under 'Permission Set' drop down.
2. If you do not have the .Net configuration wizard MMC, they open command prompt, go to c:\WINDOWS\Microsoft.NET\Framework\v<Version>\ Directory and run following command:
Caspol -m -addgroup 1.2 -url "file:///\\computername\share\*" FullTrust –n test
2. Add code group within ‘Intranet Zone’ under ‘Machine’ security configuration to give full trust to a particular public key and sign all your assemblies with the given public key.
Caspol -m -addgroup 1.2 –strong -file "< as designated by the file name, the assembly name as a string, and the assembly version in the format major.minor.build.revision>" FullTrust –n test
Caspol -m -addgroup 1.2 –strong -file myAssembly.exe myAssembly 126.96.36.199 FullTrust –n test
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.
Article ID: 948034 - Last Review: Jun 26, 2008 - Revision: 1