Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

Security exception when trying to use JavaScriptSerializer

$
0
0

I am trying to use the JavaScriptSerializer class in an event receiver which is part of a sandbox solution. When trying to use the class, I get a System.MethodAccessException with the following message:

Assembly ‘MyProjectAssembly, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=b4bce33dbc53d2b3′ is partially trusted, which causes
the CLR to make it entirely security transparent regardless of any
transparency annotations in the assembly itself. In order to access
security critical code, this assembly must be fully trusted.

Assembly ‘System.Web.Extensions, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35′ is a conditionally APTCA assembly
which is not enabled in the current AppDomain. To enable this
assembly to be used by partial trust or security transparent code,
please add assembly name ‘System.Web.Extensions, PublicKey=[something
long]‘ to the the PartialTrustVisibleAssemblies list when creating the
AppDomain.

So, I get that my assembly is partially trusted because it’s a sandbox solution. That’s fine. But how do I add the System.Web.Extensions assembly to the “PartialTrustVisibleAssemblies” so I can then use it? Is that something I can do in the VS solution package somewhere?

And if not, what are my options here?


Viewing all articles
Browse latest Browse all 148

Trending Articles