Overview of the Web Forms Architecture

An ASP.NET web form page filename uses an .aspx suffix and in this chapter is referred to as an ASPX file. Each ASP.NET web form has a class associated with it. The classes for any given ASPX file exist in a 'code-behind-the-form file,' or Codebehind file. The Codebehind's filename is specified as follows: <filename>.aspx.<language extension>, where <filename> is the filename used for the related ASPX file and <language extension> is the two-letter extension associated with the language that is used in the Codebehind file. So, for example, if the ASPX file were named Webform.aspx, the Codebehind filename would be Webform.aspx.cs if it was written in C# and Webform.aspx.vb if the Codebehind file was written in Visual Basic. An ASPX file hosts the visual elements of the web form, and the Codebehind file hosts the logic behind the web form. All of the Codebehind files are compiled into a project dynamic link library (DLL) that is deployed with the related ASPX pages. The project DLL, also known as the assembly, is named after the project, by default.

When an ASPX is requested from IIS, it is processed through the .NET Framework ASP.NET Internet Server Application Programming Interface (ISAPI) extension, aspnet_isapi.dll. The .NET Framework generates another temporary DLL based on the ASPX during the first request of the file. The temporary DLL that is generated will contain a class that inherits from the respective web form class that was generated for the web form in the Codebehind file and is hosted in the project DLL, as shown in Figure 14-1.

click to expand
Figure 14-1: Overview of the ASP.NET web forms architecture

This system provides an abstraction between the presentation logic and business logic that is more intrinsic than the ASP architecture. The Codebehind file should contain business logic and the ASPX should contain presentation logic of the web form. The system of having these two files and the capabilities each offer the programmer encourage the abstraction of the presentation logic and business logic. The ASPX files are XML files that contain HTML elements and elements representing server-side controls which create HTML. A programmer could put business logic in the ASPX files but doing so requires extra effort. The Codebehind files are code files, and placing presentation logic in the Codebehind file requires more effort than using the ASPX files. In sharp contrast, abstracting business logic and presentation logic in ASP required more effort. ASP encouraged the programmer to mix presentation logic and business logic, because to abstract them requires more effort to design the solution and the abstraction.




IIS 6(c) The Complete Reference
IIS 6: The Complete Reference
ISBN: 0072224959
EAN: 2147483647
Year: 2005
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net