1. Trang chủ
  2. » Công Nghệ Thông Tin

active server pages (asp)

102 436 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 102
Dung lượng 2,15 MB

Nội dung

 2003 Prentice Hall, Inc. All rights reserved. 1 Active Server Pages (ASP) Outline 33.1 Introduction 33.2 How Active Server Pages Work 33.3 Setup 33.4 Active Server Page Objects 33.5 Simple ASP Examples 33.6 File System Objects 33.7 Session Tracking and Cookies 33.8 ActiveX Data Objects (ADO) 33.9 Accessing a Database from an Active Server Page 33.10 Server-Side ActiveX Components 33.11 Web Resources  2003 Prentice Hall, Inc. All rights reserved. 2 Objectives • In this tutorial, you will learn: – To program Active Server Pages using VBScript. – To understand how Active Server Pages work. – To understand the differences between client-side scripting and server- side scripting. – To be able to pass data between Web pages. – To be able to use server-side include statements. – To be able to use server-side ActiveX components. – To be able to create sessions. – To be able to use cookies. – To be able to use ActiveX Data Objects (ADO) to access a database.  2003 Prentice Hall, Inc. All rights reserved. 3 33.1 Introduction • Server-side technologies – Dynamically creates Web pages • Use client information, server information and information from the Internet – Active Server Pages (ASP) • Microsoft Server-side technology • Dynamically build documents in response to client requests – Deliver dynamic Web content • XHTML, DHTML, ActiveX controls, client-side scripts and Java applets  2003 Prentice Hall, Inc. All rights reserved. 4 33.2 How Active Server Pages Work • Active Server Pages – Processed by scripting engine • Server-side ActiveX control – .asp file extension – Can contain XHTML tags – Scripting written with VBScript • JavaScript also used • Others (Independent Software Vendors) – Communication with Server • Client HTTP request to server • Active server page processes request and returns results  2003 Prentice Hall, Inc. All rights reserved. 5 33.2 How Active Server Pages Work • Active Server Pages,cont. – Communication with Server, cont. • ASP document is loaded into memory – asp.dll scripting engine on server • Parses (top to bottom)  2003 Prentice Hall, Inc. All rights reserved. 6 33.3 Setup • Web Server – Need to run Web server to use Active Server Pages • IIS 5.0 (Internet Information Services) or higher – Create a virtual directory • Copy files to c:\InetPub\Wwwroot  2003 Prentice Hall, Inc. All rights reserved. 7 33.4 Active Server Page Objects • Built-in objects – Communicate with a Web browser – Gather data sent by HTTP request – Distinguish between users – Request • Get or post information • Data provided by the user in an XHTML form • Access to information stored on client machine – Cookies – File upload (binary) – Response • Sends information to client – XHTML, text – Server • Access to server methods or properties  2003 Prentice Hall, Inc. All rights reserved. 8 33.4 Active Server Page Objects Object Name Description Request Used to access information passed by an HTTP request. Response Used to control the information sent to the client. Server Used to access methods and properties on the server. Fig. 25.1 Commonly used ASP objects.  2003 Prentice Hall, Inc. All rights reserved. 9 33.5 Simple ASP Examples • ASP Scripts – Scripting delimiters • <% %> • @LANGUAGE directive – Option Explicit • As in VBScript, forces all variables to be declared in advance – FormatDateTime • Time to display – Now • Format to display in  2003 Prentice Hall, Inc. All rights reserved. Outline 10 1 <% @LANGUAGE = VBScript %> 2 3 <% 4 ' Fig. 33.2 : clock.asp 5 ' A simple ASP example 6 Option Explicit 7 %> 8 9 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 10 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 11 12 <html xmlns = "http://www.w3.org/1999/xhtml"> 13 14 <head> 15 <title>A Simple ASP Example</title> 16 17 <style type = "text/css"> 18 td { background-color: black; 19 color: yellow } 20 strong { font-family: arial, sans-serif; 21 font-size: 14pt; color: blue } 22 p { font-size: 14pt } 23 </style> 24 25 </head> clock.asp (1 of 2) Scripting delimiter wraps around code executed on the server. Processing directive specifying scripting language Requires programmer explicitly define all variables [...]... 39 40 41 Statement for: is short Call 42 43 © 2003 Prentice Hall, Inc All rights reserved 11 12 33.5 Simple ASP Examples Fig 33.2 Simple Active Server Page © 2003 Prentice Hall, Inc All rights reserved 1 2 3 4 . Prentice Hall, Inc. All rights reserved. 1 Active Server Pages (ASP) Outline 33.1 Introduction 33.2 How Active Server Pages Work 33.3 Setup 33.4 Active Server Page Objects 33.5 Simple ASP Examples 33.6. with Server • Client HTTP request to server • Active server page processes request and returns results  2003 Prentice Hall, Inc. All rights reserved. 5 33.2 How Active Server Pages Work • Active. content • XHTML, DHTML, ActiveX controls, client-side scripts and Java applets  2003 Prentice Hall, Inc. All rights reserved. 4 33.2 How Active Server Pages Work • Active Server Pages – Processed

Ngày đăng: 24/10/2014, 12:07

TỪ KHÓA LIÊN QUAN

w