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.

192 Part III: Building Secure <strong>Web</strong> <strong>Application</strong>sDiagnosing APTCA IssuesIf you attempt to call a strong named assembly that is not marked with APTCA frompartial trust code such as a partial trust <strong>Web</strong> application, you see an exception similarto the one shown in Figure 8.4. Notice that the exception details provide nopermission details <strong>and</strong> simply indicate that the required permissions (in this case,FullTrust) cannot be acquired from the calling assembly. In this case, the somewhatconfusing description text means that the error occurred because the application’s level was set to something other than Full.Figure 8.4The result of partial trust code calling a strong named assemblyTo overcome this exception, either the calling code must be granted FullTrust or theassembly being called must be annotated with APTCA. Note that individual typeswithin an assembly marked with APTCA might still require full trust callers, becausethey include an explicit link dem<strong>and</strong> or regular dem<strong>and</strong> for full trust, as shown in thefollowing examples.[PermissionSet(<strong>Security</strong>Action.LinkDem<strong>and</strong>, Name="FullTrust")][PermissionSet(<strong>Security</strong>Action.Dem<strong>and</strong>, Unrestricted=true)]

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

Saved successfully!

Ooh no, something went wrong!