What Prevents Harmful Code from Executing?

In the case where an application is executed directly from an untrusted environment such as the Internet, code-access security prevents harmful code from executing by first checking whether the code has permission to perform a particular operation such as deleting files—this is formally known as making a Demand for a particular permission. For example, when the chart component—contained on a Web page—executes a statement such as the Visual Basic .NET Kill statement to delete a file, the Kill statement first demands a permission to delete files, and if the permission is not granted a security exception is thrown and the file is not deleted.

Get Security for Microsoft® Visual Basic® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.