green field

Running mojoPortal in Medium Trust Environments

Rate this Content 3 Votes

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. 

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: http://dev.mysql.com/downloads/connector/net/1.0.html or if using PostgreSQL, the npgsql driver from here: http://pgfoundry.org/projects/npgsql.

Another minor issue to be aware of when running mojoPortal 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 theme.skin file to this location even though the runtime "thinks" it is getting this file from App_Themes/Default. The VirtualPathProvider will fail gracefully if there is a security exception caused by Medium trust but you will need to copy your theme.skin file from the skin you want to use into the App_Themes/Default folder. This makes it s little inconvenient to change skins but this is what is needed under Medium trust. The reason that this is a minor issue is because we don't use the theme.skin for much. We mainly use CSS for style.

Related Developer Resources:

Using Code Access Security in ASP.NET
How To Use Code Access Security to Constrain an Assembly
Enabling WePermission in Medium Trust
Medium Trust ASP.NET Applications

Last Updated 2009-10-25

Web Hosting by mojoPortal Experts Your advertisement here xSQL Software SQL Tools
Form Wizard Pro - Easy Forms and Surveys for mojoPortal