tailieunhanh - Programming Microsoft ASP.NET 3.5

tài liệu về hệ điều hành Programming Microsoft . | Microsoft Programming Microsoft Dino Esposito Chapter 3 Anatomy of an Page In this chapter Invoking a The Page The Page Life pages are dynamically compiled on demand when first required in the context of a Web application. Dynamic compilation is not specific to pages .aspx files it also occurs with .NET Web Services .asmx files Web user controls .ascx files HTTP handlers .ashx files and a few more application files such as the file. A pipeline of run-time modules takes care of the incoming HTTP packet and makes it evolve from a simple protocol-specific payload up to the rank of a server-side object precisely an instance of a class derived from the system s Page class. The HTTP runtime processes the page object and causes it to generate the markup to insert in the response. The generation of the response is marked by several events handled by user code and collectively known as the page life cycle. In this chapter we ll review how an HTTP request for an .aspx resource is mapped to a page object the programming interface of the Page class and how to control the generation of the markup by handling events of the page life cycle. Invoking a Page Let s start by examining in detail how the .aspx page is converted into a class and then compiled into an assembly. Generating an assembly for a particular .aspx resource is a two-step process. First the source code of the resource file is parsed and a corresponding class is created that inherits either from Page or another class that in turn inherits from Page. Second the dynamically generated class is compiled into an assembly and cached in an temporary directory. The compiled page remains in use as long as no changes occur to the linked .aspx source file or the whole application is restarted. Any changes to the linked .aspx file invalidates the current page-specific assembly and forces the HTTP

TỪ KHÓA LIÊN QUAN