Understanding the Structure and Functioning of an ASP.NET Page, Slides of Computer Programming

An overview of an asp.net page, its components, and the process of compiling and rendering it. It covers topics such as inline and code behind coding, processing directives, the page class, and page events. The document also discusses the role of iis and the page life cycle.

Typology: Slides

2012/2013

Uploaded on 09/27/2013

vikrant
vikrant 🇮🇳

4.4

(9)

119 documents

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Anatomy of an ASP.NET
Page
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download Understanding the Structure and Functioning of an ASP.NET Page and more Slides Computer Programming in PDF only on Docsity!

Anatomy of an ASP.NET

Page

My Version

of the Big Picture (1)

ASP Worker (Engine)

Your application Runs

Server

Other applications

User 1 User 2

Session 1 Session 2 Client (Browser)

Request Response

What is an ASP.NET Page?

 Roughly speaking, an ASP.NET page contains  Markup (appears in the .aspx page)  Server-side code that the ASP.NET worker executes (appears in the .aspx page or in a separate code behind page)  The resulting HTML is sent out to the client (browser) by the asp worker process

ASP.NET Coding

 There are two ways to do it  Inline (code appears in the same file as the .aspx file)  Put in a **

ASP.NET Code Behind

 They are matching .aspx and .aspx.cs files that are hopelessly tied together  @Page directives are important  The CodeBehind attribute points to the .cs file  The Language attribute identifies the programming language  VB / C#

ASP.NET Code Behind

Compiling

an

ASP page

(Illustration)

IIS File Mappings

 .asax – application files  .ascx – ASP user controls  .asmx – Web services  .aspx – ASP.NET Web pages

Processing Directives (1)

 Processing directives are used to configure the runtime environment  Directives can appear anywhere on a page but best practices dictate that they appear at the beginning of the page  Directives begin with <%@ and end with %>  Make sure you don’t forget the %>

Processing Directives (2)

 Processing directive are used to configure the runtime environment  Processing directives have the following format: <%@ directive_name attribute=“value” attribute=“value” %>

Processing Directives

( @ Page )

 It can appear only in .aspx pages  Attributes are divided into roughly three categories  Compilation  Page behavior  Page output

 There are other tools to configure the same options beyond processing directives

Processing Directives

Page Compilation

CodeFile lists the file containing the VB or C# code for the .aspx page  Language describes the programming language for the CodeFileClassName explicitly sets the name of the class created upon compilation

Introduction to the Page Class

 The Page class provides the basic behavior for an ASP Web page  It’s objects allow you to reference  The application itself ( Application )  The server itself ( Server )  The HTTP request ( HttpRequest )  The HTTP response ( HttpResponse )  The user’s session ( Session )

Introduction to Page Events

 First, this topic is very important to getting your ASP applications to work  ASP uses the eventing model to  Persist state from one postback to the next  Create static and dynamic controls  Bind control instances to data sources  And much more  As your book says “state is an illusion of continuity”