Introduction to ASP.NET (aspx)
Preparing a development environment
Notes:
  • Like ASP Classic you can use Development GUI (VS.NET), but you can also edit your aspx files with any text editor since they are plain text.
  • Preferred OS: Windows 2000 or better, Windows XP or better
Installation:
  1. If not already installed, install IIS from the OS Installation CD
  2. Install all the latest critical updates, service packs and patches (run WindowsUpdate)
  3. If not already installed, install the .NET framework. Run WindowsUpdate, go to the "Recommneded updates" section (following "Critical updates"). If .NET is not installed you will have it listed as an available. Select it to download and install. Or you can download ir here
  4. Download and install the .NET Framework SDK. You need to install it in order to be sure that you will be able to run and test aspx applications. The .NET Framework alone does not guaratee this.
  5. Create a folder under your IIS webroot directory (or a virtual IIS folder whereever) to store your aspx test files
aspx Structure
The main structure can be decomposed in:
  • Server Scripts section (<script runat="server"></script>) that includes
    • Events routines
    • User defined routines that may involve Server Controls
  • HTML body with Server Controls section embebed (<form runat="server"></form>)
    The Server Control section is where the server is instrcuted to create the HTML output by programming "server components". These server components can be referred at the Server Scripts Section.
    At the Server Control Section you may have
    • HTML Server Controls - Traditional HTML tags with runat="server" attribute (<html_tag id="id" runat="server" ...other_tag_attributes... >...</html_tag>)
    • Web Server Controls - New ASP .NET tags (<asp:control_type id="id" runat="server" ...other_tag_attributes... > ... </asp:control_type>)
    • Validation Server Controls - For input validation (<asp:control_type id="id" runat="server" ...other_tag_attributes... > ... </asp:control_type>)
  Example
aspx Forms
Notes:
  • The server controls section is the only form in an aspx document.
    You build your form there using HTML and server controls
  • ViewState: by default all the values of the form fields are maintained by .NET if the page is call back from its own code.
    All the fields are presented in the browser with their values from the previous instance.
    To disable this behavior for all the page declare <%@ Page EnableViewState="false" %> at the top of the aspx.
    To disable this behavior for a specific server control add the attribute EnableViewState="false".