12
Web Forms
and ASP.NET
Programming Right from the Start
with Visual Basic .NET 1/e
Objectives
• Understand the relationship between
HTML and ASP.NET
• Understand how web applications work in
terms of the client/server model
• Develop ASP.NET applications using a text
editor
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
2
Objectives (cont.)
• Develop ASP.NET applications using Visual
Studio .NET
• Understand the similarities and differences
between Windows Forms and Web Forms
• Develop interesting web applications using
ASP.NET and Visual Studio
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
3
12-1 HTML and
Static Web Pages
• HTML stands for Hypertext Markup
Language, a language for displaying text in
a web browser such as Internet Explorer or
Netscape Navigator.
• Text is marked by tags consisting of a left
angle bracket (<), a tag name, and a right
angle bracket (>).
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
4
12-1 HTML and
Static Web Pages (cont.)
• Tags are usually paired to start and end
the tag instruction.
• The end tag looks like the start tag except
a slash (/) precedes the text with the
brackets.
• Some tags can be used without an end tag.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
5
12-1 HTML and
Static Web Pages (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
6
12-2 Web Applications
• A web application is a client/server
application that lives on a web server.
• The client is the user’s machine with an
Internet browser.
• The web server is a machine that stores the
web documents, including web pages and
server scripts.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
7
Round Trips
• Postback is when a user action occurs that
requires server processing and the form is
posted back to the server.
• The web server processes the request and
generates new HTML that is returned to the
client browser.
• This sequence of events is referred to as a
round trip.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
8
Round Trip (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
9
12-3 ASP.NET
• ASP.NET is a platform for developing and
running web applications on a web server.
• ASP.NET web applications can be
developed with a simple text editor or with
the assistance of Visual Studio .NET.
• Microsoft’s Internet Information Services
(IIS) is a web server for use on Windows
machines.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
10
12-4 Visual Studio
and Web Forms
• Visual Studio provides the following tools:
–
–
–
–
Visual designers
Code-aware editors
Integrated compilation and debugging
Project management facilities for creating and
managing application files
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
11
12-4 Visual Studio
and Web Forms (cont.)
• Visual Studio supports Web Forms to
quickly and easily create the user interface
for ASP.NET web applications.
• A Web Form is composed of two files, the
user interface form and the code-behind
file.
• Web Forms are similar to Windows forms
in that they are event driven.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
12
12-4 Visual Studio
and Web Forms (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
13
ASP.NET Illustrated:
Jake’s Problem
• Begin by starting a New Project and
selecting ASP.NET Web Application.
• If Visual Studio is successfully able to
communicate with the web server, then it
will create a project on the server and open
WebForm1.aspx for editing.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
14
ASP.NET Illustrated:
Jake’s Problem (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
15
ASP.NET Illustrated:
Jake’s Problem (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
16
ASP.NET Illustrated:
Jake’s Problem (cont.)
• The programming logic resides in a codebehind file with an .aspx.vb extension.
• The logic written in the code-behind could
have been written with any .NET language
such as C#.
• When the application is run Visual Studio
launches Internet Explorer and connects to
the ASPX page on the server.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
17
ASP.NET Illustrated:
Jake’s Problem (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
18
ASP.NET Illustrated:
Jake’s Problem (cont.)
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
19
Chapter Summary
• HTML stands for Hypertext Markup
Language, a language for displaying text in
a web browser such as Internet Explorer or
Netscape Navigator.
• Web applications are web sites that go
beyond normal, static web sites by adding
the ability to process code in response to
user input.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
20
Chapter Summary (cont.)
• Web applications are also client/server
applications.
• When a user action occurs that requires
web server processing, the form must be
posted back to the server.
• ASP.NET is a platform for developing and
running web applications on the web
server.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
21
Chapter Summary (cont.)
• Web Forms allow quick and easy creation
of ASP.NET web applications.
• Web Forms are similar to Windows Forms
in that they are event driven.
Crews/Murphy – Programming Right From the Start with Visual Basic.NET 1/e – ©2004 Prentice Hall
22
12
Web Forms
and ASP.NET
Programming Right from the Start
with Visual Basic .NET 1/e
Descargar

Click to Add Title - Pearson Education