Re: Refusing all permissions

From: Eugene V. Bobukh [MS] (eugenebo_at_online.microsoft.com)
Date: 07/07/03


Date: Mon, 7 Jul 2003 11:07:40 -0700


Well, I guess in order to run assembly requires at least one permission, that is permission to execute. So what you probably need is the following:

[assembly: SecurityPermissionAttribute(SecurityAction.RequestMinimum, Execution = true)]
[assembly:PermissionSetAttribute(SecurityAction.RequestOptional, Unrestricted = false)] // Note that it is FALSE here

Also, depending on the version of the Runtime, it may happen that the single attribute you used below could be just ignored, there were couple of weirdnesses in declarative attributes handling for such corner cases [I beleive they are fixed now].

If you truly need to refuse even execution for some reason, replace the first line with this:

[assembly:PermissionSetAttribute(SecurityAction.RequestMinimum, Unrestricted = false)]

-- 
Eugene V. Bobukh
This message is provided "AS IS" with no warranties, and confers no rights. Any opinions or policies stated within it are my own and do not necessarily constitute those of my employer.
----
"Keith Patrick" <richard_keith_patrick@hotmail.com> wrote in message news:eb4swWJRDHA.2480@tk2msftngp13.phx.gbl...
> Does anyone know how to "properly" declare that an assembly requires no
> permissions whatsoever to run?  What I want to do is have my base library do
> this, and then consumers of the library do the same, but selectively and
> explicitly activate the permissions it needs.  What I had been doing is
> this:
> [assembly:PermissionSet(SecurityAction.RequestOptional, Unrestricted=false)]
> 
> However, when I manually follow it with various attributes where I say
> RequestMinimum/Unrestricted=true, my WIndows service still will not run, and
> I've requested every permission I can find.  The only thing that allows my
> service to run is following the aforementioned code with:
> 
> 
> 
> [assembly:PermissionSet(SecurityAction.RequestOptional, Unrestricted=true)]
> 
> 


Relevant Pages

  • Re: System.Security.SecurityException was unhandled
    ... The exception gave you the CLSID. ... the first thing to check might be whether the COM server ... assembly actually has the permission in question. ... When I execute the application I received and error message. ...
    (microsoft.public.dotnet.security)
  • Re: System.Security.SecurityException was unhandled
    ... assembly actually has the permission in question. ... Try and find the sorce of the security permission error, ... setting was done on both versions 1.1 and 2.0 .NET framework. ... When I execute the application I received and error message. ...
    (microsoft.public.dotnet.security)
  • Re: System.Security.SecurityException was unhandled
    ... Is it a must that I need to register the COM server to the machine using ... CAS permissions on the client machine, and the COM issue is a new problem. ... assembly actually has the permission in question. ... When I execute the application I received and error message. ...
    (microsoft.public.dotnet.security)
  • Re: SQL CLR Sproc isnt running right
    ... did you grant rights using the SQL Server 2005 Surface Area Config tool? ... and I got a permissions error back saying DBO doesn't have permission to insert records into the table... ... but the assemblie's stored procedures do all have execute permissions set for the role that the executing user is in... ... "William Vaughn" wrote in message ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: System.Security.SecurityException was unhandled
    ... I was using Oracle so was getting an Oracle permission problem. ... setting was done on both versions 1.1 and 2.0 .NET framework. ... On the server or the client? ... When I execute the application I received and error message. ...
    (microsoft.public.dotnet.security)

Quantcast