Iron Speed Designer Help
 

Setting the .NET Trust Level for your Application

Trust Levels

Microsoft .NET applications can run in any of the following trust levels:

  • Full trust - your code can do anything that the account running it can do.

  • High trust - same as ‘Full trust’ except your code cannot call into unmanaged code, such as Win32 APIs and COM interop.

  • Medium trust - same as ‘High trust’ except your code cannot see any part of the file system except its own application directory.

  • Low trust - same as ‘Medium trust’ except your code cannot make any out-of-process calls, such as calls to a database, network, etc.

  • Minimal trust - code is restricted from anything but the most trivial processing (calculating algorithms).

Medium trust restrictions

Many application hosting service providers run applications in the ‘Medium trust’ level.  The main constraints placed on Medium trust Web applications are:

  • Iron Speed Designer does not support .NET Framework 4.0/4.5 web site running in Medium Trust. To run in Medium Trust, convert the web site to a web application.

  • The MySQL database is not supported in .NET Framework 4.0 running under Medium Trust.

  • OleDbPermission is not available. This means you cannot use the ADO.NET managed OLE DB data provider to access databases.  However, you can use the managed SQL Server provider to access SQL Server databases.

  • EventLogPermission is not available.  This means you cannot access the Windows event log.

  • ReflectionPermission is not available.  This means you cannot use reflection.

  • RegistryPermission is not available.  This means you cannot access the registry.

  • WebPermission is restricted.  This means your application can only communicate with an address or range of addresses that you define in the <trust> element.

  • FileIOPermission is restricted. This means you can only access files in your application's virtual directory hierarchy. Your application is granted Read, Write, Append, and PathDiscovery permissions for your application's virtual directory hierarchy.

You are also prevented from calling unmanaged code or from using Enterprise Services.

Setting the trust level for your Iron Speed Designer-application

Iron Speed Designer requires a custom or modified Medium Trust policy.  Specifically, the following exceptions to the Medium Trust policy must be applied based on the underlying database product used by the application:

  • OleDB Permission: Required by Iron Speed Designer applications using Microsoft Access.

  • ODBC Permission: Required by Iron Speed Designer applications using MySQL.

  • Oracle Permission: Required by Iron Speed Designer applications using Oracle.

  • Socket Permission: Required by Iron Speed Designer applications using MySQL.

  • Reflection Permission: Required for all Iron Speed Designer applications.

  • SqlClient Permission: This permission is already granted for Medium Trust level and is required for Iron Speed Designer applications using Microsoft SQL Server.

Please note that if you are using Microsoft Access, you also need read and write access to the file system to be able to read and save data.  The Microsoft Access database must also be resident in the application folder.

Event logging must be turned off

To run Iron Speed Designer applications in the Medium Trust environment, the Event Logging feature must be turned off in your application’s Web.config file.

<add key="LogEvents" value="false" />

This event log feature is turned off by default.

AllowPartiallyTrustedCallers attribute (APTCA)

All assemblies or DLLs used in an application must have the Allow Partially Trusted Callers Attribute (APTCA) specified in order to run under Medium Trust.  All DLLs included by Iron Speed Designer are already marked with the APTCA attribute, including BaseClasses.DLL and Reports.DLL.  Any additional DLLs included in your application must also be marked with this attribute.

The following code must be added in the DLL’s AssemblyInfo.vb file to make assemblies APTCA compatible.

Imports System.Security

<Assembly: AllowPartiallyTrustedCallers()>

The following DLLs used by Iron Speed Designer applications are marked with the APTCA attribute:

DLL

Notes

BaseClasses.dll

APTCA Marked

AjaxControlToolkit.dll

APTCA Marked

Ciloci.Flee.dll

APTCA Marked

FredCK.FCKeditorV2.dll

APTCA Marked

MySql.Data.dll

APTCA Marked

Report.dll

APTCA Marked

System.Web.Extensions.dll

APTCA Marked

Validators.dll

No (can run under medium trust)

CarlosAg.ExcelXmlWriter.dll

No (can run under medium trust)

The following DLLs do not have the APTCA attribute specified and will not run under Medium Trust:

DLL

Notes

BaseClasses.dll

Iron Speed Designer V5.2.X or earlier

MySql.Data.dll 

Version 5.0.7.0 or earlier

Report.dll

Iron Speed Designer V5.2.X or earlier

Recaptcha.dll

Iron Speed Designer V9.0.0 and later

Additional Reading

http://msdn2.microsoft.com/en-us/library/ms998341.aspx