I was having the same issue. I would develop things on my localhost and it would work fine (even pull data from the Jodohost MySql server). When I uploaded it I got the dreaded Security Exception. I posted a ticket last night around midnight CST and have yet to receive a response.
Consequently, I am impatient and a problem solver so I did some homework. The issue appears to be that JodoHost has it’s clients set up as Medium trust or lower for ASP.NET 2.0. Unfortunately, that cuts off most database access except for SQL Server. To give us access to MySql (or any other ODBC compliant database) JodoHost’s trust policy needs to be modified. (see Technical documentation | Microsoft Learn )
In your default web.config file (located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG) you will have a line like this:
(When you develop on your localhost box the default level is “Full” which inherits security from Windows and therefore grants you all permissions. If you want to immitate JodoHost, change it from “Full” to “Medium” and save the web.config file. Refresh your data driven page and see what happens.)
Other built-in possibilities for the “level” attribute are Full, High, Low, and Minimal. These should be defined in the section of the web.config file. As part of the definition it also shows which policy file it will use (e.g. - for trustLevel Medium the policyFile=“web_mediumtrust.config”). This, and all other policy configuration files will be located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG.
To give us access to the Odbc classes and allow us to connect to MySql through ASP.NET 2.0 the following lines need to be added to the web_XXXXXtrust.config file…
Add the following to the node:
<SecurityClass Name=“OdbcPermission” Description="System.Data.Odbc.OdbcPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=“b77a5c561934e089”/>
Add the following to the node:
I have a feeling this is important to many customers, including myself.