Introduction to ASP.NET

Download Report

Transcript Introduction to ASP.NET

Introduction to ASP.NET
2
Outline
•
•
•
•
Static vs. Dynamic Web Pages
.NET Framework
Installing ASP.NET
First ASP.NET Application
© UW Business School, University of Washington 2004
3
Static Web Pages
• Traditionally web only provides static information
• A Web page author composes an HTML page, and
saves it as an .htm or .html file
• A user types a page request via URL into the browser,
and the request is sent from the browser to the Web
server
• The Web server receives the page request and
locates the .htm/.html page in local file system
• The Web server sends the HTML stream back across
the Internet to the client browser
• The browser interprets the HTML and displays the
page
© UW Business School, University of Washington 2004
4
Processing a Request for an
HTML Page
© UW Business School, University of Washington 2004
5
Dynamic Web Pages
• Content does not exist before a page is
requested
• Content, at least part of it, is generated upon
request
• For example:
– the current time on the Web server
– Online shopping basket
• Purpose: Transaction!
© UW Business School, University of Washington 2004
6
Components for a Web-Based System
HTTP
request
(cleartext
or SSL)
Web
Client
SQL
Database
Firewall
Web app
Web
Server
Web app
Web app
DB
DB
Web app
HTTP reply
(HTML,
Javascript,
VBscript,
etc)
© UW Business School, University of Washington 2004
•Apache
•IIS
•Netscape
etc…
Plugins:
•Perl
•ASP.NET
•JSP, etc
Database
connection:
•ADO,
•ODBC, etc.
7
CGI, ASP, and JSP
• CGI
– Compiled
– Difficult to modify and update
– Consumes huge resources on the server
• ASP
– Mix ASP script with HTML
– Easy
– ASP script itself needs to be interpreted every time it is
requested
• JSP
– Server side scripting based on Java
– Available in different platforms
– Concepts very similar to ASP
© UW Business School, University of Washington 2004
8
Java
• Java is simple
• Java is object-oriented
• Java is distributed
• Java is interpreted
• Java is robust
• Java is secure
• Java is architecture-neutral
• Java is portable
• Java is multithreaded
• Java is dynamic
© UW Business School, University of Washington 2004
9
The .NET Framework
• ASP.NET is used to develop dynamic Web applications
within the .NET Framework
• The .NET Framework consists of:
– A Common Language Runtime (CLR)
– A hierarchical set of Base Class Libraries (BCL)
• The .NET Framework is the architectural model for
creating programs that interface with the operating
system and the base class libraries
© UW Business School, University of Washington 2004
10
The .NET Framework
© UW Business School, University of Washington 2004
11
Web Services
• Web services encompass a set of related
standards that can enable any two computer
applications to communicate and exchange
data via a network.
• Key Web services technologies
–
–
–
–
XML
SOAP
WSDL
UDDI
© UW Business School, University of Washington 2004
12
ASP.NET
• Overcome the major drawbacks of ASP
• Supports VB and C#
• Have a rich set of controls
© UW Business School, University of Washington 2004
13
ASP.NET Installation
•
Requirement for Operating Systems
–
•
Windows 2000/2003, or Windows XP Professional or Home
Install the following
– MDAC (Microsoft Data Access Components)
•
•
Download MDAC 2.8 at www.microsoft.com/data (not SDK)
Filename: MDAC_TYP.EXE (5.4 MB)
– .NET Framework Redistributable version 1.1
•
•
•
Download at www.asp.net
Click Download link at the top right part of the window and
choose to download .NET
Filename: dotnetfx.exe (23.7 MB)
– Web Matrix
•
•
Download at www.asp.net
Filename: WebMatrix.msi (1.3 MB)
© UW Business School, University of Washington 2004
ASP.NET Installation (Cont’d)
Edit WebMatrix.exe.config file located at
C:\Program files\Microsoft ASP.NET WebMatrix\v0.6.812\
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="microsoft.matrix">
<section name="packages"
type="Microsoft.Matrix.Core.Packages.PackageListSectionHandler,
Microsoft.Matrix"/>
…
Insert this
</sectionGroup>
part
</configSections>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
<runtime>
…
© UW Business School, University of Washington 2004
14
First ASP.NET Program
<html>
<head><title>First ASP.NET Program</title></head>
<body>
<script language=“VB” runat="server">
Sub Page_Load()
Response.write ("This is my first line of ASP.NET _
program. <br>")
Response.write ("More to come next week. <br>")
End sub
</script>
</body></html>
© UW Business School, University of Washington 2004
15