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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 9: Using Code Access <strong>Security</strong> with ASP.NET 225If an application is configured with a trust level other than “Full,” it is referred to as apartial-trust application. Partial-trust applications have restricted permissions, whichlimit their ability to access secured resources.Important <strong>Web</strong> applications built on .NET Framework version 1.0 always run with full trust becausethe types in System.<strong>Web</strong> dem<strong>and</strong> full-trust callers.Configuring Code Access <strong>Security</strong> in ASP.NETBy default, <strong>Web</strong> applications run with full trust <strong>and</strong> have unrestricted permissions. Tomodify code access security trust levels in ASP.NET, you have to set a switch inMachine.config or <strong>Web</strong>.config <strong>and</strong> configure the application as a partial-trustapplication.Configuring Trust LevelsThe element in Machine.config controls whether or not code access security isenabled for a <strong>Web</strong> application. Open Machine.config, search for ““, <strong>and</strong> youwill see the following.With the trust level set to “Full,” code access security is effectively disabled becausepermission dem<strong>and</strong>s do not st<strong>and</strong> in the way of resource access attempts. This is theonly option for ASP.NET <strong>Web</strong> applications built on .NET Framework version 1.0. Asyou go through the list from “Full” to “Minimal,” each level takes away morepermissions, which further restricts your application’s ability to access securedresources <strong>and</strong> perform privileged operations. Each level gives greater degrees ofapplication isolation. Table 9.1 shows the predefined trust levels <strong>and</strong> indicates themajor restrictions in comparison to the previous level.

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

Saved successfully!

Ooh no, something went wrong!