Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4238286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:53:07+00:00 2026-05-21T02:53:07+00:00

This is similar to Odd Exception in MVC 3 Project . We have an

  • 0

This is similar to Odd Exception in MVC 3 Project.

We have an ASP.NET 4.0 application running in full trust. We need to have the following line in our web.config, otherwise one of the libraries we are using does not function. (As it explicitly uses the now obsolete CAS model from previous versions of .NET).

<trust legacyCasModel="true" />

Given this setting, we are unable to use the dynamic keyword or certain features of ASP.NET MVC which rely on it.

As an example, the following code causes an exception:

dynamic d = new object();
d.test = "jason";

The exception is:

Dynamic operations can only be performed in homogenous AppDomain.

Is there any way I can make the dynamic keyword work if legacyCasModel is set to true? (If set to false, everything works fine, except the library that requires it.)

Ideas:

  1. Given that I am running in full trust, I assume that one assembly in the AppDomain is utilizing reduced permissions (hence the non-homogeneous). Is there a way I can simply tell it to run in full trust mode, making the AppDomain homogeneous?

  2. Should I be able to refactor my code somehow to load the problematic assembly in another AppDomain? I’m not familiar with typical ways of doing this, but it appears complex.

  3. Is there some other magical configuration setting I can enable to make it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:53:07+00:00Added an answer on May 21, 2026 at 2:53 am

    I haven’t used much DLR stuff but I just tried a quick test. In a console application the equivalent of your command fails …

            dynamic d = new object();
            d.test = "jason";
            Console.WriteLine(d.test);
    

    But this succeeds …

            dynamic d = new ExpandoObject();
            d.test = "jason";
            Console.WriteLine(d.test);
    

    When using dynamic objects you may need to use ExpandoObject rather than plain old object.

    In cases where ExpandoObject doesn’t meet your needs something more powerful like http://clay.codeplex.com/

    === EDIT ===

    Helps if I read the question fully …

    Adding in <trust legacyCasModel="true" level="Full" /> to the mix causes both to fail with the error provided.

    “legacyCasModel” forces a non-homogeneous domain as it is the pre-.net4 way of doing things. This means that dynamic objects and your older CAS library are incompatible.

    The only valid workaround that I can see would be to abstract that older CAS library to run in a seperate application domain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to split this/similar string to get the VALUE <a href=javascript:void(0); id=def_ name=color
This is similar to this question, except the code is already written. I have
I have a little bit of an odd issue. When I run this SQL:
This is an odd question. I have a friend who is working on an
What is this about I notice many many apps I use have a similar
I asked a similar question yesterday, but have acquired a really odd problem since
I have code similar to this in Objective-C: SubclassOfNSObject *GlobalVariableThatShouldNeverChange; @implementation MyClass +(void) initialize
I found this similar question here , but this is really old. Was it
int main() { int p; scanf(%d,&p); fun() { int arr[p]; // isn't this similar
This is similar to my previous posting. But this time I want to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.