If your application runs at medium trust, it faces a number of restrictions, the most significant of which are:
It cannot directly access the event log.
It has restricted file system access and can only access files in the application’s virtual directory hierarchy.
It cannot directly access OLE DB data sources (although medium trust applications are granted the SqlClientPermission, which allows them to access SQL Server).
It has limited access to Web services.
It cannot directly access the Windows registry.
This section shows you how to access the following resource types from a medium-trust Web application or Web service:
Medium-trust Web applications are not granted the OleDbPermission ...