Exception "Object synchronization method was called from an unsynchronized block of code." in MVC
<p>I am loading up some values from my database to be displayed to my website users. Since these values won't be changing too much, I am loading them up into a static/shared object. </p>

<p>To ensure that multiple users aren't modifying this same object at the same time, I am using <code>Monitor.Enter</code> (and <code>Monitor.Exit</code>) to lock/block around the loading of these values.</p>

<p>Unfortunately, this does not work when being called from an MVC view in .NET as it throws this exception: </p>

<blockquote>
  <p>Object synchronization method was called from an unsynchronized block of code.</p>
</blockquote>

<p>Is there a way to do this, via MVC, without completely changing my code design?</p>