Running mojoPortal in Medium Trust Environments

The information below is legacy information for older versions of mojoPortal. We no longer use NeatUpload in mojoPortal and therefore no loner require or ship a separate Web.config file for medium trust. The issues about .net 3.5 and themes are still true but we no longer support .net 3.5 or 4.0, we only support .net 4.5 and everything should work fine in medium trust by default.

Quick Fix for Medium Trust

  1. Rename Web.config file to Web.fulltrust.config
  2. Rename Web.mediumtrust.config to Web.config (the difference between the 2 files is mainly that we comment out the references to NeatUpload in the Medium Trust version).
  3. Make sure the App_Data folder exists and is writable by the web process user

That should get you up and running in most cases. (Note steps 1 and 2 are no longer needed when using the latest MS SQL packages for mojoPortal because they are pre-configured for Medium Trust)

The MS SQL ADO.NET Provider is usually already available in the GAC. The MySQL Connector or the npgsql driver for PostgreSQL would also need to be installed in the GAC for those databases to work in Medium Trust. You would need to download the version signed with a strong name key from the MySQL site here: or if using PostgreSQL, the npgsql driver from here:

Important Skinning and Design Issues under Medium Trust

Another issue to be aware of when running mojoPortal content management system under Medium trust has to do with the skinning. Because mojoPortal is capable of supporting multiple web sites using a single installation we store the skin files in a site specific folder under Data/Sites[SiteID]/skins/ to keep them separate between the different sites that may be running. To do this we use a custom VirtualPathProvider that directs requests for the file to this location even though the runtime "thinks" it is getting this file from App_Themes/Default. VirtualPathProviders unfortunately do not work in medium trust under .NET 3.5 or lower (it works under .NET 4). The VirtualPathProvider will fail gracefully if there is a security exception caused by Medium trust but you will need to copy your file from the skin you want to use into the App_Themes/Default folder, otherwise settings in your file will not take effect. This makes it a little inconvenient to change skins but this is what is needed under Medium trust. This also poses a problem if you want to use multiple skins like different skins on different pages because all skins will use the same file and the settings in that one file may not be right for all of the skins. It also is a problem when hosting multiple sites in a single installation, all sites will use the same file. The file is especially important for skins designed with Artisteer because settings in that file tell mojoPortal how to render the right elements and CSS class names needed by the Artisteer designs which have changed over time depending on the version of Artisteer used to create the design. Since VirtualPathProviders do work under .NET 4 Medium Trust, you can avoid this problem altogether by using .NET 4 hosting and the .NET 4 packages of mojoPortal.

Related Developer Resources:

Enabling WePermission in Medium Trust
Medium Trust ASP.NET Applications

Last Updated 2011-02-15