A trend in the software industry is to shift the workload of many code writing to the infrastructure of the basic platform. Many development platforms simply require developers to use relatively loose syntax to describe the information they need at a higher level, rather than to Hard-code by byte by a strict set of grammatical rules. Now, developers often use the XML language to describe the desired results, analyze the content through the compiler or the Run-time engine, and process it into traditional executable code.
For example, Windows®presentation Foundation (one of the pillars of the. NET Framework 3.0) uses XAML as an xml-based rendering language to describe the form user interface. The Microsoft AJAX Library (part of a system formerly known as asp.net "Atlas") uses its Xml-script meta language to apply the same principles to rich-text Web pages (although technically, xml-script is not part of its core publishing content, Instead, it is shared as an unofficial sample technology. Xml-script is a declarative layout language that combines HTML elements and scripts to form virtual client controls. Finally, Xml-script introduces logical processing and functionality for the client page.
There are several advantages to authoring Web pages and forms using declarative language. In this way, server-side components make it easier to generate pages and forms without having to generate actual Visual basic®, C #, or JavaScript code. In addition, declarative markup is inherently easier to design for authoring tools such as Visual studio®. From an architectural standpoint, declarative markup is the way to specify the behavior of page elements, rather than how these elements implement such behavior. This way, you can create more layers of abstraction.
The first specific programming environment to take advantage of this model is the ASP. NET (starting from version 1.0). As most Web developers now know, asp.net pages are usually written in one or two files: an. aspx tag file and an optional code-behind file. The code-behind file contains class files written in any supported programming language (usually Visual Basic or C #). The. aspx markup file contains HTML tags that form the page structure, asp.net control tags, and text (it can also contain code). This text is parsed at run time and converted to a page class. Such a page class, combined with code-behind classes and some system-generated code, forms executable code to process any submitted data, generate a response, and then send it back to the client.
Although the overall model is known to most asp.net developers, there are a number of "black holes" in which only a few developers have a deep understanding. MSDN®, related books and online articles explain all aspects of the page mechanism, but there is still a lack of a comprehensive and unified introduction to the internal mechanism of the page. If you look at the HTML source code for the ASP.net page, you'll find a lot of hidden fields and automatically inserted JavaScript blocks that you probably barely understand. However, it is with the support of these fields and code blocks that the Web page works correctly. In this column, I'll analyze the client source code generated by the ASP.net page. Not only do I have to discuss hidden fields that are familiar, such as view state, but also some of the less-known hidden fields, such as control state, event validation, event targets and parameters, and the scripting code provided by the system.
Many of the implementation details I've discussed here are for the current ASP.net version. These details will change in future releases (as opposed to previous versions), so you should not build any running code that relies on unwritten details.