Hi
Commends in line.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Thread-Topic: WHich is the recomended approach?
>thread-index: AcWIlQ3pJu458QDjQOWtISgOfydDxg==
>X-WBNR-Posting-Host: 199.45.247.98
>From: "=?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=" <thielen@nospam.nospam>
>References: <32278900-BAD2-49B8-8D2C-E1AB849FE33A@microsoft.com>
<CE6D6A1E-069B-48C2-A3D4-A35C671026E6@microsoft.com>
<7175AE8B-251B-46C0-8D0D-FAB5231C8240@microsoft.com>
<dJVl9bFiFHA.2840@TK2MSFTNGXA01.phx.gbl>
>Subject: RE: WHich is the recomended approach?
>Date: Thu, 14 Jul 2005 09:57:01 -0700
[quoted text clipped - 25 lines]
>specifically listed becomes RequestRefuse.
> 2b. This does not happen for a RequestRefuse - correct?
Yes, the RequestOptional will combine the RequestOptional and
RequestMinimum and denied others including the RequestRefuse also it is
refused already.
>3. If you have any RequestOptional or RequestRefuse, the code becomes APTCA
>- which is bad
RequestOptional or RequestRefuse will make an assembly less permission, so
it usually is not a fulltrusted assemlby, when it wanted to call an strong
name assembly which have problem.
APTCA
An assembly that has a strong name cannot be called by a partial trust
assembly (an assembly that is not granted full trust), unless the strong
named assembly contains AllowPartiallyTrustedCallersAttribute (APTCA) as
follows:
[assembly: AllowPartiallyTrustedCallersAttribute()]
But enable AllowPartiallyTrustedCallersAttribute for the strongname
assembly, your code is immediately more vulnerable to attack. So we avoid
Using APTCA.
"Your assembly is to be called by another assembly that refuses specific
permissions by using SecurityAction.RequestRefuse or
SecurityAction.RequestOptional. These make the calling assembly a partial
trust assembly. "
> 3b. I like the idea of setting
>[assembly:SecurityPermission(SecurityAction.RequestRefuse,
>UnmanagedCode=true)] - but should not as that makes it APTCA - correct?
As above.
> 3c. I had [assembly:SecurityPermission(SecurityAction.RequestRefuse,
>UnmanagedCode=true)] set in the DLL and did not get a permission error - any
>idea why?
This refuse the call to unmanaged code, did your assembly try to call the
unmanaged code?
UnmanagedCode Ability to call unmanaged code.
Since unmanaged code potentially allows other permissions to be bypassed,
this is a dangerous permission that should only be granted to highly
trusted code. It is used for such applications as calling native code using
PInvoke or using COM interop.
> 3d. Out of curiosity - why does this make code APTCA?
As above
>4. This all started in my case because I added
>[assembly:FileIOPermission(SecurityAction.RequestOptional,
[quoted text clipped - 6 lines]
>Assemblyinfo.vb" - but it seems there is no way to list optional permissions
>that my code may need???
That is why the documents suggest you test your code first to ensure your
have the necessary permission setting
Or you may try to look into the msdn to see what permisson certain
operation in your code needed.