Which of the following is an attribute that needs to be set at the beginning of a program in order to monitor a Web page’s life cycle?

Which of the following is an attribute that needs to be set at the beginning of a program in order to
monitor a Web page’s life cycle?

Which of the following is an attribute that needs to be set at the beginning of a program in order to
monitor a Web page’s life cycle?

A.
AutoEventWireup

B.
Server.Transfer

C.
Response.Redirect

D.
Global.asax

Explanation:
The AutoEventWireup attribute is an attribute of the @ Page directive. It determines whether the
ASP.NET events are autowired. In other words, ASP.NET automatically connects the methods
containing specific names, such as Page_Init() and Page_Load(), with the page events. If the attribute
is set to true, the events autowiring is enabled. Otherwise, it is set to false.
Answer B is incorrect. The Server.Transfer() method is used to navigate from one page to another.
When the method is called, execution of the first page is terminated and execution of the second
page begins. It passes the page information, such as input field values, to the second page. It means
only the ASP built-in objects and the ASP Error object values are transferred from the first page to
the second page. Any variables declared on the first page are not available on the second page. Use
the IsCrossPagePostback property of the first page object to determine whether the current page is
posted from the Server.Transfer() method call. If the Server.Transfer() method is used, the
IsCrossPagePostBack property value is false. If a cross-page posting is used, the IsCrossPagePostBack
property value is true.
Answer C is incorrect. Redirect is a method of the Response object. It is used to navigate through
the server script. This method sends a redirect message to the browser, causing it to attempt to
connect to a different URL. The Response.Redirect method accepts the Uniform Resource Locator
(URL) of the page, to which a user has to be redirected, as a parameter.
Syntax:
Response.Redirect URL
where, URL is the Uniform Resource Locator (URL) of the page to which a user has to be redirected.
Answer D is incorrect. Global.asax is an optional file that contains code for responding to global
events that occur in a Web application. There can be only one Global.asax file for an application. This
file resides in the root directory of an ASP.NET application. External users cannot download or view
the code written within the Global.asax file.



Leave a Reply 0

Your email address will not be published. Required fields are marked *