Which of the following directives is used to define page-specific attributes that are used by the Web
page parser and compiler?
A.
@Control directive
B.
@Include directive
C.
@ServiceHost directive
D.
@Page directive
Explanation:
The @Page directive is used to define page-specific attributes that are used by the Web page parser
and compiler. The @ Page directive is a directive syntax of a Web page. It is used to define pagespecific attributes that are used by the Web page parser and compiler. Some commonly used
attributes of the @ Page directive are AutoEventWireup, CodeBehind, CodeFile, Inherits, and
Language. The syntax of the @ Page directive is as follows:
<%@ Page attribute=”value” [attribute=”value”…] %>
Answer A is incorrect. The @ Control directive is a directive syntax of a Web Forms page. It is used
to define user-control specific attributes that are used by the ASP.NET page parser and compiler. The
directive is used only with user controls. Some commonly used attributes of the @ Control directive
are Language, AutoEventWireup, ClassName, and Inherits. The syntax of the @ Page directive is as
follows:
<%@ Control attribute=”value” [attribute=”value” … ] %>
Answer C is incorrect. The @ServiceHost directive is used to associate the service host factory with
the WCF service to be hosted. This directive is required to access or compile the service hosting code
provided in a .svc file.
Answer B is incorrect. The include directive inserts code of the included file into a JSP page at
translation time, i.e., when the JSP page is compiled. This include mechanism is also known as static
include. The included file can be a JSP page, an HTML file, a text file, or Java code. If any change is
made in the included file, the JSP page has to be recompiled. The syntax of the include directive is as
follows:
<%@ include file=”path” %>
Here, path is the relative path of the file to be included.