Skip to Content
Programming Visual Basic .NET
book

Programming Visual Basic .NET

by Dave Grundgeiger
December 2001
Beginner
464 pages
13h 51m
English
O'Reilly Media, Inc.
Content preview from Programming Visual Basic .NET

Using Directives to Modify Web Page Compilation

You can modify web page compilation by including directives. Directives are keywords that are recognized and acted on by the ASP.NET page compiler. They affect a page’s compilation, rather than its presentation. Directives are delimited by the characters <%@ and %> and can appear at any location in the source file (although Microsoft says that “standard practice” is to place them at the top of the file). For example, the following <%@ Page %> directive was shown in Example 6-1, earlier in this chapter:

<%@ Page Language="vb" AutoEventWireup="false" 
   CodeBehind="WebForm1.aspx.vb" Inherits="IdeExamples.WebForm1"%>

Directives are similar in form to HTML tags. There is the directive itself, followed by one or more attributes that specify various settings associated with the directive. A directive without attributes has no effect. Directives are different from HTML tags in that the delimiters are different and in that directives have no closing tags.

ASP.NET defines the following directives and associated attributes:

@ Assembly

Provides a way to reference assemblies defined elsewhere. This directive’s attributes are:

Name

Specifies the name of an assembly in the global assembly cache. For example:

<%@ Assembly Name="System.Windows.Forms" %>
SRC

Specifies the path of a Visual Basic .NET source file to be compiled and referenced. The path is relative to the web application’s virtual folder. For example:

<%@ Assembly SRC="SomeClass.vb" ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Visual Basic .NET, Second Edition

Programming Visual Basic .NET, Second Edition

Jesse Liberty

Publisher Resources

ISBN: 0596000936Supplemental ContentCatalog PageErrata