ASP.NET
  Home arrow ASP.NET arrow Developing ASP.NET Web Applications
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

Developing ASP.NET Web Applications
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2009-06-23

    Table of Contents:
  • Developing ASP.NET Web Applications
  • An introduction to ASP.NET application development
  • The components of the .NET Framework
  • Three environments for developing ASP.NET applications

  • 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


    Developing ASP.NET Web Applications


    (Page 1 of 4 )

    In this second part of a three-part series on ASP.Net web programming, you'll learn how state is handled in ASP.Net web applications, the components of the .NET framework, and more. 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).

    How state is handled in ASP.NET applications

    Although it isn’t apparent in the previous figure, an application ends after it generates a web page. That means that the current status of any data maintained by the application, such as variables or control properties, is lost. In other words, HTTP doesn’t maintain the state of the application. This is illustrated in figure 1-5.

    Here, you can see that a browser on a client requests a page from a web server. After the server processes the request and returns the page to the browser, it drops the connection. Then, if the browser makes additional requests, the server has no way to associate the browser with its previous requests. Because of that, HTTP is known as a stateless protocol.

    Although HTTP doesn’t maintain state, ASP.NET provides several ways to do that, as summarized in this figure. First, you can use view state to maintain the values of server control properties. For example, you can use view state to preserve the Text properties of label controls that are changed as a web form is processed or to maintain a list of items in a drop-down list. Because ASP.NET implements view state by default, you don’t need to write any special code to use it.

    Second, you can use session state to maintain data between executions of an application. To make this work, ASP.NET creates a session state object that is kept on the server whenever a user starts a new session. This session object contains a unique session ID, and this ID is sent back and forth between the server and the browser each time the user requests a page. Then, when the server receives a new request from a user, it can retrieve the right session object for that user. In the code for your web forms, you can add data items to the session object so their previous values are available each time a web form is executed.

    Third, you can use an application state object to save application state data, which applies to all of the users of an application. For example, you can use application state to maintain global counters or to maintain a list of the users who are currently logged on to an application.

    Fourth, you can use the profile feature to keep track of user data. Although a profile is similar to a session state object, it persists between user sessions because it is stored in a database. When you use profiles, for example, you can keep track of the last three products that a user looked at in his last session. Then, when the user starts a new session, you can display those products in a “Recently viewed items” list.

    Why state is difficult to track in web applications

    Concepts

    1. State refers to the current status of the properties, variables, and other data maintained by an application for a single user. The application must maintain a separate state for each user currently accessing the application.
    2. HTTP is a stateless protocol. That means that it doesn’t keep track of state between round trips. Once a browser makes a request and receives a response, the application terminates and its state is lost.

    Four ASP.NET features for maintaining state

    1. ASP.NET uses view state to maintain the value of form control properties that the application changes between executions of the application. Since view state is implemented by default, no special coding is required.
    2. When a user starts a new session, ASP.NET creates a session state object that contains a session ID. This ID is passed from the server to the browser and back to the server so the server can associate the browser with an existing session. To maintain session state, you can add program values to the session state object. 
       
    3. When an application begins, ASP.NET creates an application state object. To maintain application state, you can add program values to the application state object. These values are available to all users of the application until the application ends. 
       
    4. ASP.NET can also maintain a profile for each user of an application. Because profiles are stored in a database, the profile data is maintained from one user session to another. This makes it easier to personalize an application.

    Figure 1-5  How state is handled in ASP.NET applications

    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

    - ASP.NET DotNetNuke Installation with Visual ...
    - Using ASP.NET with a MySQL Database
    - Using ASP.NET with an MS Access Database
    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - 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





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek