ASP.NET
  Home arrow ASP.NET arrow An ASP.NET Web Application in Action
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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

An ASP.NET Web Application in Action
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 2
    2009-06-24

    Table of Contents:
  • An ASP.NET Web Application in Action
  • The aspx code for the Order form
  • The Visual Basic code for the Order form
  • How an ASP.NET application is compiled and run
  • Perspective

  • 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


    An ASP.NET Web Application in Action


    (Page 1 of 5 )

    In this conclusion to a three-part series on ASP.Net web programming, you'll take a look at how an ASP.Net application actually works. This article is excerpted from chapter one of Murach's ASP.NET 3.5 Web Programming with VB 2008, written by Anne Boehm (Murach, 2008; ISBN: 1890774472).

    A quick preview of how an ASP.NET application works

    With that as background, you’re ready to learn more about how an ASP.NET application works. That’s why this topic presents a quick preview of how the Order form in the Shopping Cart application works.

    The files used by the Shopping Cart application

    Figure 1-9 presents the Order form of the Shopping Cart application as it appears in the Web Forms Designer that you use when you develop web forms with Visual Studio 2008. In chapter 2, you’ll learn how to use this Designer, but for now just try to get the big picture of how this form works.

    If you look at the Designer window in the middle of the IDE, you can see the table that’s used for this form as well as the label controls that are used to display the data for each product. You can also see that the smart tag menu for the drop-down list has been used to enable the AutoPostBack property. This means that the Order form will be posted back to the web server when the user selects an item from the drop-down list.

    If you look at the Solution Explorer to the right of the Designer window, you can see the folders and files that this application requires. For now, though, just focus on the six code files that are summarized in the table in this figure. The first two files in this table, which are in the App_Code folder, are two files that represent business classes named CartItem and Product. Both of these files have vb as the extension, which means that they’re Visual Basic files.

    The next four files in the table are for the two web forms, Cart and Order, with two files for each form. The files with aspx as the extension (Cart.aspx and Order.aspx) contain the code that represents the design of the form. This code consists of standard HTML code plus asp tags that define the server controls used on the forms. We refer to this as aspx code, because the files that contain the code have the aspx extension.

    The other two files, which have aspx.vb as the extension, contain the Visual Basic code that controls the operation of the forms. These are called code-behind files because they provide the code behind the web forms. For instance, the Order.aspx.vb file is the code-behind file for the Order form.

    Before I go on, you should realize that it isn’t necessary to store the aspx and Visual Basic code for a web form in separate files. Instead, ASP.NET lets you combine this code into a single aspx file. However, storing the aspx and Visual Basic code in separate files can simplify application development because it lets you separate the presentation elements for a page from its Visual Basic coding. This also makes it possible for HTML designers to work on the aspx files for an application, and then have Visual Basic programmers develop the code for the code-behind files.

    The Order form in Design view

    The aspx and Visual Basic files in the Shopping Cart application

    Folder  File Description
    App_Code CartItem.vb A class that represents an item in the shopping cart.
    App_Code Product.vb A class that represents a product.
    (root) Cart.aspx The aspx file for the Cart page.
    (root) Cart.aspx.vb The code-behind file for the Cart page.
    (root) Order.aspx The aspx file for the Order page.
    (root) Order.aspx.vb The code-behind file for the Order page.

     

    Description

    1. For each web form in an application, ASP.NET 3.5 keeps two files. The file with the aspx extension holds the HTML code and the asp tags for the server controls. The file with the aspx.vb extension is the code-behind file that contains the Visual Basic code for the form. 
       
    2. If an ASP.NET 3.5 application requires other classes like business classes, they are kept in the App_Code folder.

    Figure 1-9  The files used by the Shopping Cart application

    More ASP.NET Articles
    More By Murach Publishing


     

    Buy this book now. This article is an excerpt from chapter one of Murach's ASP.NET 3.5 Web Programming with VB 2008, written by Anne Boehm (Murach, 2008; ISBN: 1890774472). Check it out today at your favorite bookstore. Buy this book now.

    ASP.NET ARTICLES

    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...
    - Building an In-Text Advertising System Under...
    - Developing a Mini ASP.NET AJAX Server Centri...





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