473,809 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CAS, mixing assembly (RequestOptiona l) and method permissions

Hi
(Second CAS question)

At the assembly level I have:

[assembly: PermissionSet(S ecurityAction.R equestOptional)]

at the method level I have

[ReflectionPermi ssion(SecurityA ction.Demand,
Flags=Reflectio nPermissionFlag .RestrictedMemb erAccess,
RestrictedMembe rAccess=true)]

my method is empty.

However this gives me this message:

Request for the permission of type "..ReflectionPe rmission..." 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 1302
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 PublicPrivatePa ir.snk

// add these attributes to the AssemblyInfo.cs file
[assembly: AssemblyDelaySi gn(false)]
[assembly: AssemblyKeyFile ("PublicPrivate Pair.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
23692
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
2401
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
1203
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
2038
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* much, and I can't figure out which individual permissions I need to add back to make this code work. It works fine if I use FullTrust instead of Internet, but obviously that isn't safe. I get these security errors from code running in the...
4
4363
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 = Assembly.LoadFrom("http://mysite/myAssembly.dll"); Does anyone know how to do this, or something equivalent?
1
2931
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 my Dlls are located give the ASPNET user full control, and all Dlls used by the Assembly in question are in the local folder with the rest of the web application Dlls. Could someone take a look at my error and shed some light on this?
7
960
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 c:\inetpub\wwwroot and rebooted before reinstalling. I created a new virtual directory from within IIS (e.g. MyWebTest). Then I tried to create a new Visual C# ASP.NET Web Application pointing to the location http://localhost/MyWebTest. I get...
0
3968
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 getting the Access denied error. After checking different settings and googling I wasnt able to pinpoint the problem and as a temporary fix I decided to merge the two assemblies into one, my logic being no offending assembly no access denied...
2
2155
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 can I do this with .NET 2.0? I find some detail with this topic from a link as below http://msdn.microsoft.com/en-us/library/system.security.permissions.strongnameidentitypermission.aspx In the .NET Framework versions 1.0 and 1.1, identity...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10375
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.