Today's Thought

If men could regard the events of their own lives
with more open minds, they would frequently discover
that they did not really desire the things they failed to obtain

Friday, August 19, 2011

Advantages of the code-behind model

  • Code-behind pages offer a clean separation of the HTML markup (user interface) and code.
  • Code is not exposed to graphic designers or others who are working only with the page HTML markup.

The Code-Behind Page Model:

  • HTML markup are kept in one file and the programming code in another file.
  • There are two differences in the .aspx page between the single-file and the code-behind models:
    • In the code-behind model, there is no <script> block with the runat="server" attribute.
    • In the code-behind model, the @Page directive contains attributes that reference an external file and a class.
  • The code file contains a partial class, which indicates that the class contains only some of the total code that makes up the full class for the page.  
  • The partial class inherits from a base Page class (either System.Web.UI.Page or a class derived from System.Web.UI.Page). 
  • The .aspx file contains an Inherits attribute that points to the code-behind partial class.
  •  When the page is compiled, ASP.NET creates a new partial class for the .aspx file. This class is a peer of the code-behind partial class file and contains the declarations for the page’s controls.
  • Finally, ASP.NET generates a class that inherits from the partial class created from the .aspx file and the code-behind partial class.
  • The generated class is compiled into an assembly that runs in order to render output to the browser.

Thursday, August 18, 2011

The Single Page Model File

  • The page’s HTML markup and its programming code are in the same physical .aspx (extension) file.
  • The programming code is contained in a <script> block that specifies the attribute runat=“server”.
  • At run time, the compiler converts a single-file page into a class that derives from the System.Web.UI.Page.  
 Advantages of the single-file model include the following: 
  • In pages without a lot of code, keeping the programming code and the HTML markup in a single file proves to be very convenient while studying the file.
  • Pages written by using the single-file model are slightly easier to deploy or to send to another programmer because there is only one file.
  • A single-file page is easier to rename because there is no dependency between files.
  • Managing files in a source code control system is slightly easier because the page is self-contained in a single file.

      Wednesday, August 17, 2011

      All About ASP.NET

      What Is ASP.NET

      ASP.NET is a Web application framework marketed by Microsoft that can be used to build dynamic Web sites, Web applications, and XML Web services.

      It is part of Microsoft's .NET platform and is the successor to Microsoft's Active Server Pages (ASP) technology.

      Applications developed using ASP.NET must be hosted on an Internet Information Services (IIS) server.

      Advantages of ASP.NET

      • Enables you to access information from data sources, such as back-end databases and text files that are stored on a Web server.
      • Provides enriched tool support in the form of Visual Studio .NET integrated development environment (VS .NET IDE).
      • Enables you to develop your application in any .NET language.
      • Enables you to build user interfaces that separate application logic from presentation content.
      • Enables you to manage Web applications by storing the configuration information in an XML file.
      • Helps improve developer productivity and provides facilities for improving the performance, reliability, and scalability of Web applications.
      ASP.NET Web Page Code Model
      •  Visual Elements 
      •  Programming logic for the page
      ASP.NET provides two models for managing the visual elements and code:
      • Single-file page model
      • Code-behind page model