Thank you so much for your help so far.
I've tried the steps you outline below but now get a SecurityException
without the SQLClient message. Unfortunately, catching the exception and
trying to debug is unhelpful as trying to access any useful fields in the
exception such as GrantedSet, PermissionState, RefusedSet and TargetSite
result in another SecurityException.
My custom permission set is based on the LocalIntranet permission set,
adding the SQL client permission (unrestricted).
Using caspol -rsg confirms that the membership is set up as described in
your message, using caspol -rsp I can see a SQLClientPermission in the
permission set. I've attached the results of running caspol -rsg and -rsp
below.
Let me know if you have any other suggestions.
thanks!
Jahyen.
-----
caspol -rsg
Microsoft (R) .NET Framework CasPol 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Level = Enterprise
Code Groups:
1. All code: FullTrust
Level = Machine
Code Groups:
1. All code: Nothing
1.2. Zone - Intranet: LocalIntranet
1.2.1. All code: Same site Web.
1.2.2. All code: Same directory FileIO - Read, PathDiscovery
1.2.3. StrongName -
002400000480000094000000060200000024000052534131000400000100010025714CFA96F5
C44412EAA70F06EA6474D61B5B5FE22F723D9E944A8BF96F3655271DF7EF481FBEDB16D32D1C
B317ED03FA3A4CC2F4F79DC74D54822D66935AFED5AEC84EE47FD89A29DA78C70F0D76207160
0C86509081BDE1BF82B509B0A0893CC9E03D08CB999AAF3E1A609460AEAEEF5A8448E977CDE7
07BF42C4242861C2: LocalIntranet + SQL Client
Level = User
Code Groups:
1. All code: FullTrust
Success
-------------------------------------
caspol -rsp
Microsoft (R) .NET Framework CasPol 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.
Resolving permissions for level = Enterprise
Resolving permissions for level = Machine
Resolving permissions for level = User
Grant =
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.EnvironmentPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Read="USERNAME"/>
<IPermission class="System.Security.Permissions.FileDialogPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Security.Permissions.FileIOPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Read="\\intranet.local\contacts\"
PathDiscovery="\\intranet.local\contacts\"/>
<IPermission
class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775807"
Expiry="9223372036854775807"
Permanent="True"/>
<IPermission class="System.Security.Permissions.ReflectionPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Flags="ReflectionEmit"/>
<IPermission class="System.Security.Permissions.SecurityPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Assertion, Execution, BindingRedirects"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Net.DnsPermission, System, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission class="System.Drawing.Printing.PrintingPermission,
System.Drawing, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="DefaultPrinting"/>
<IPermission class="System.Diagnostics.EventLogPermission, System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1">
<Machine name="."
access="Instrument"/>
</IPermission>
<IPermission class="System.Data.SqlClient.SqlClientPermission,
System.Data, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Unrestricted="true"/>
<IPermission
class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000
10025714CFA96F5C44412EAA70F06EA6474D61B5B5FE22F723D9E944A8BF96F3655271DF7EF4
81FBEDB16D32D1CB317ED03FA3A4CC2F4F79DC74D54822D66935AFED5AEC84EE47FD89A29DA7
8C70F0D762071600C86509081BDE1BF82B509B0A0893CC9E03D08CB999AAF3E1A609460AEAEE
F5A8448E977CDE707BF42C4242861C2"
Name="Contacts"
AssemblyVersion="1.0.1653.30918"/>
<IPermission class="System.Security.Permissions.UrlIdentityPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Url="file://intranet.local/contacts/contacts.exe"/>
<IPermission class="System.Security.Permissions.ZoneIdentityPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089"
version="1"
Zone="Intranet"/>
</PermissionSet>
Success