11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

240 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sMedium Trust RestrictionsIf your application runs at medium trust, it faces a number of restrictions, the mostsignificant of which are:● It cannot directly access the event log.● It has restricted file system access <strong>and</strong> can only access files in the application’svirtual directory hierarchy.● It cannot directly access OLE DB data sources (although medium trustapplications are granted the SqlClientPermission, which allows them to accessSQL Server).● It has limited access to <strong>Web</strong> services.● It cannot directly access the Windows registry.This section shows you how to access the following resource types from a mediumtrust<strong>Web</strong> application or <strong>Web</strong> service:● OLE DB● Event log● <strong>Web</strong> services● RegistryOLE DBMedium-trust <strong>Web</strong> applications are not granted the OleDbPermission. Furthermore,the OLE DB .NET data provider currently dem<strong>and</strong>s full-trust callers. If you have anapplication that needs to access OLE DB data sources while running at medium trust,use the s<strong>and</strong>boxing approach. Place your data access code in a separate assembly,strong name it, <strong>and</strong> install it in the GAC, which gives it full trust.Note Modifying policy does not work unless you set the trust level to “Full” because the OLE DBmanaged provider dem<strong>and</strong>s full trust.Figure 9.3 shows the arrangement.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!