Questions tagged [partial-trust]

Partial trust is a .NET security model in which application code executes with reduced permissions as a measure of protecting the local system from malicious use.

Partial trust is part of Microsoft's Code Access Security (CAS) model introduced with .NET 2.0.

Examples of partial trust: If you run a .NET application that resides on a network share, or you download an application via a web browser, the application will run with reduced permissions. The app will not be allowed direct access to the local file system or system registry, and will not be able to make certain kinds of network connections. The intent of partial trust is to reduce the risk of potentially malicious code downloaded from network locations from damaging or stealing information on the local machine.

With the release of .NET 4.0, portions of CAS have been deprecated or are no longer implemented, including the RequestOptional and LinkDemand SecurityActions, among others. http://msdn.microsoft.com/en-us/library/system.security.permissions.securityaction.aspx

46 questions
21
votes
3 answers

What is a partially trusted assembly/application/code/etc in .NET?

Could someone please explain? I couldn't find anything on the internet, everything talks about how to go about it in some way, but nothing says exactly what it is. Also, what is a fully trusted assembly and how do they differ from one another? I…
sker
  • 17,842
  • 8
  • 37
  • 41
15
votes
6 answers

Assembly does not allow partially trusted caller

How do I change my library to allow partially trusted callers? I get the following error: Server Error in '/' Application. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. …
Andreas
  • 1,311
  • 5
  • 24
  • 39
11
votes
3 answers

That assembly does not allow partially trusted callers. InitializeComponent()

Scenario: I am in the process of refactoring one of our applications to use Nhibernate and came across this issue a couple weeks back. The issue was originally with Nhibernate and Castle and to solve this they were both recompiled with the…
Gage
  • 7,365
  • 9
  • 47
  • 77
8
votes
2 answers

ASP.NET Varying Trust Level Per-Page by Assembly?

I have two web applications (pre-compiled sites), one is first-party and will run at full trust. Another is third-party and should run at partial trust (or with specific permissions). TrustedAssembly.Web.Pages.MyPage should run in the full trust…
lukiffer
  • 11,025
  • 8
  • 46
  • 70
4
votes
1 answer

Running MSTest in partial trust from within Visual Studio

I like to be able to run MSTest in partial trust. This would allow me to configure what the code, that my unit tests call, can and can't do. The problem I'm trying to solve is to let my automated (unit) tests fail when things like the file system,…
Steven
  • 166,672
  • 24
  • 332
  • 435
4
votes
2 answers

Is it possible to use Silverlight RiaServices without IIS?

I want to use silverlight as my windows service interface. For that, I'm using a custom web server to provide the xap file and it works fine. Now I want to use RiaServices, but of course I there is no IIS involved. Here is my…
andrecarlucci
  • 5,927
  • 7
  • 52
  • 58
3
votes
2 answers

How can I access my assembly version number in a partial trust environment (no FileIOPermission)

I'm trying to access the Version number of my assembly at runtime. The code I'm using for that requires a FileIOPermission, which I don't want to grant (I'm in the Internet Zone) this.GetType().Assembly.GetName().Version; Is there another way to…
Brann
  • 31,689
  • 32
  • 113
  • 162
3
votes
1 answer

Grant FullTrust in trusted assembly called by partial trust assembly

imagine the following environment: an XBAP application running in partial trust mode (default behaviour; requiring Full Trust is not an option - but before you ask, if full trust is given to the XBAP, everything works as expected) is referencing a…
thmshd
  • 5,729
  • 3
  • 39
  • 67
3
votes
0 answers

dotnetopenauth samples "Attempt by method 'DotNetOpenAuth.OAuth2.WebServerClient ..."

I've just been spending hours on an issue that some others have reported to experience too. The Sample.Oauth2.OAuthClient projet sample does not work for me. Let me explain in details: I got the latest version of dotnetopenauth from github (december…
oldbrazil
  • 367
  • 4
  • 11
2
votes
2 answers

MySql.Data in GAC, still SecurityException

I have a problem with MySql.Data in a partial trusted environment. I've added MySql.Data to the GAC (by installing it with the MSI from the mysql.com site). As you can see here: >gacutil /l | grep -i mysql MySql.Data, Version=6.5.4.0,…
2
votes
3 answers

Why can't I subscribe to an event in a partial-trust AppDomain?

In my default (full-trust) AppDomain I want to create a sandbox AppDomain and subscribe to an event in it: class Domain : MarshalByRefObject { public event Action TestEvent; } Domain domain = AppDomainStarter.Start(@"C:\Temp", "Domain",…
Qwertie
  • 16,354
  • 20
  • 105
  • 148
2
votes
1 answer

Windows Server AppFabric Caching

I'm currently working on a ASP.NET MVC site where we have to run in partial trust. Now I'm facing a problem with connecting to AppFabric when in High Trust. No problems when running in full trust. What Permission do I need in my…
2
votes
2 answers

How can I use the system.net section of my app.config in a partial trust environment?

I've a WCF application deployed using clickonce. It connects to my server using https, and everything works fine I use the default proxy when needed thanks to the following code:
Brann
  • 31,689
  • 32
  • 113
  • 162
2
votes
2 answers

Partial trust: How to instantiate a generic type without a generic type argument

I'm creating a reusable library for Silverlight. The library contains an internal generic type and I need to create a new instance of this generic type, but I at one point I don't have a generic type argument available, only a System.Type object…
Steven
  • 166,672
  • 24
  • 332
  • 435
2
votes
1 answer

NPOI dll (third party excel writer dll)....System.Security.SecurityException: That assembly does not allow partially trusted callers

I had developed portal on Asp.net mvc framework.I had hosted this site at godaddy hosting.I had a great problem on integrating third party dll i.e. NPOI (excel writer dll).It dispaly following error. Security Exception **Description**: *The…
MikMark
  • 547
  • 1
  • 5
  • 17
1
2 3 4