473,388 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

CAS, mixing assembly (RequestOptional) and method permissions

Hi
(Second CAS question)

At the assembly level I have:

[assembly: PermissionSet(SecurityAction.RequestOptional)]

at the method level I have

[ReflectionPermission(SecurityAction.Demand,
Flags=ReflectionPermissionFlag.RestrictedMemberAcc ess,
RestrictedMemberAccess=true)]

my method is empty.

However this gives me this message:

Request for the permission of type "..ReflectionPermission..." failed

Can you mix and match these permissions? I thought the method level
permission was an explicit Demand for the security so would be ok?

thanks
Sep 19 '08 #1
1 1285
Also, this might be useful for other people to know as its taken a
while to get this working

(1) Permissions at the policy level (user/machine/enterprise) are
intersected
(2) Permissions at the Code group level (regardless of if nested) are
union'd

assuming they are applicable to your assembly of course

So, in practice, how can I make my assembly more or less secure?

(1) To make it more secure add a new code group which applies to just
your assembly. Once you've created it right click on it, properties,
and click on the first checkbox you can see. This means only the
permissions you see here are applicable, others are ignored
(2) To make it less secure just add a new Code Group which applies
just to your assembly. The permissions you add will get union'd with
the others to make it less secure

Last thing, how can you refer to your assembly? One of 2 ways
(1) StrongName (purely for testing)

// run this in Visual Studio command prompt, place the new file where
the application can see it
sn -k PublicPrivatePair.snk

// add these attributes to the AssemblyInfo.cs file
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("PublicPrivatePair.snk")] (this is
deprecated but it does the job for testing)

(2) By URL, e.g. file://C$/<rest of path to your executables filename)

Sep 20 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rudolf | last post by:
Is it possible to add a vb.net source code module to a c# project and if so how? Thanks Rudolf
3
by: Daylor | last post by:
hi. im loading assembly from my computer and createInstance from it. till now it worked ok. now, im changing the path from : c:\myfolder\myassembly.dll to
5
by: Earth Worm Jim | last post by:
Is there a tool that tells me what permissions my assembly requires? I have add to deny all permissions I just want to now grant one I require? Cheers Earth Worm Jim
1
by: Jesse McGrew | last post by:
Hi, I'm trying to create an AppDomain and use it to load an assembly with reduced permissions (e.g. the "Internet" named permission set). Unfortunately, the permissions seem to be reduced *too*...
4
by: Eric Marthinsen | last post by:
Hello- I'm looking to do something similar to Assebly.Load or Assembly.LoadFrom, but rather than specify the file name, I want to give it a URL, so, I could do something like this: Assembly a...
1
by: Brian | last post by:
I've looked through the previous posts on this one and have verified permissions and location of my Dlls, but I am still getting an exception when I try to Load an assembly. The directory where...
7
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I first did a complete uninstall of .NET 2003, .NET Framework 1.1, and IIS. I also completely deleted...
0
by: Andy | last post by:
Thanks Peter, I thought I'd give an update on this problem. My application had 2 assemblies that contained classed for the Data access and business logic layer. It was on one of them that I was...
2
by: Ares Chen | last post by:
Hi, all In .NET 1.1, I can protect my assembly by use "StrongNameIdentityPermission", so only the caller with the special StrongName Sign can call my functions in the important assembly. But how...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.