ASP.NET
  Home arrow ASP.NET arrow Page 2 - ASP.NET Architecture, Part 2
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

ASP.NET Architecture, Part 2
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2004-03-03

    Table of Contents:
  • ASP.NET Architecture, Part 2
  • The Global.aspx.vb File
  • Creating a Web Form
  • Creating User Controls
  • Adding Controls
  • Server Control Types and Web Controls
  • Error Handling and Security

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ASP.NET Architecture, Part 2 - The Global.aspx.vb File


    (Page 2 of 7 )

    Although this ASP.NET server page does not allow for any user interaction, it does demonstrate browser-based application functionality in its most elementary form.

    The Global.aspx.vb file contains information about the sequence of events and when they fire. The file begins by importing System.Web and the System.Web.SessionState. Public Class Global inherits the System.Web.HttpApplication class. After the InitializeComponent() method performs its task and allows for any other initialization, several events fire. The first event is the Application_Start method. The next event, Session_Start, fires, followed by the Application_BeginRequest method, which fires at the beginning of each subsequent request. Then the Application_AuthenticateRequest method fires. Other methods include Application_Authentication, Application_Error, Session_End, and Application_End. Here is the Global.aspx.vb file:


    Imports System.Web 
    Imports System
    .Web.SessionState 
    Public 
    Class Global 
         Inherits System
    .Web.HttpApplication 
    #Region " Component Designer Generated Code " 
        Public Sub New() 
          MyBase.New() 
          'This call is required by the Component Designer. 
          InitializeComponent() 
          'Add any initialization after the InitializeComponent() call 
        End Sub 
     
        
    'Required by the Component Designer 
        Private components As System.ComponentModel.IContainer 

        '
    NOTEThe following procedure is required by the Component
        
    'Designer 
        '
    It can be modified using the Component Designer
        
    'Do not modify it using the code editor. 
        <System.Diagnostics.DebuggerStepThrough()>  
        Private Sub InitializeComponent() 
          components = New System.ComponentModel.Container()  
        End Sub 
     
    #End Region 
     
        Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) 
           '
    Fires when the application is started 
        End Sub 
        Sub Session_Start
    (ByVal sender As ObjectByVal e As EventArgs
           
    'Fires when the session is started 
        End Sub 
        Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs) 
           '
    Fires at the beginning of each request 
        End Sub 
        Sub Application_AuthenticateRequest  
        
    (ByVal sender As ObjectByVal e As EventArgs
           
    'Fires upon attempting to authenticate the user 
        End Sub 
        Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) 
           '
    Fires when an error occurs  
        End Sub 
        Sub Session_End
    (ByVal sender As ObjectByVal e As EventArgs
           
    'Fires when the session ends 
        End Sub  
     
        Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) 

           '
    Fires when the application ends 
        End Sub 
     
    End 
    Class 

    The lesson learned from examining this file is that the ASP.NET execution works entirely differently from classic ASP pages. Every .aspx page is automatically converted to a class and subsequently compiled to an assembly the first time it is accessed by a client. Expect some latency (delay) from this scenario.

    When the user accesses the page, the generated assembly executes and creates an instance of that page. The page object provides a method for each event and generates output that is ultimately sent to the client’s browser.

    This has been part two of ASP.NET Architecture (see part 1 here), chapter six of .NET & J2EE Interoperability, by Dwight Peltzer (McGraw-Hill/Osborne, ISBN 0-07-223054-1, 2004).

    Buy this book now.

    More ASP.NET Articles
    More By McGraw-Hill/Osborne


     

    ASP.NET ARTICLES

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT