Active Server Pages (ASP) 1. 2 Introduction Active Server Pages (ASP) –Server-side text file –Processed in response to client request –Pages are processed.

Slides:



Advertisements
Similar presentations
1 Active Server Pages (ASP) Dr. Awad Khalil Computer Science Department AUC.
Advertisements

DT228/3 Web Development WWW and Client server model.
Session 13 Active Server Pages (ASP) Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
Languages for Dynamic Web Documents
DT211/3 Internet Application Development Active Server Pages & IIS Web server.
Building Applications using ASP.NET and C# / Session 1 / 1 of 21 Session 1.
Server-Side vs. Client-Side Scripting Languages
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
Pertemuan 3 Server Side Scripting (ASP & ASP.Net) Matakuliah: T0053/Web Programming Tahun: 2006 Versi: 2.
DT211/3 Internet Development Application Internet Development Application.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
1 Active Server Pages Active Server Pages (ASPs) are Web pages ASP = server-side scripts + HTML The appearance of an Active Server Page depends on who.
Introduction to Web Interface Technology (CSE2030)
 2001 Prentice Hall, Inc. All rights reserved. 1 Active Server Pages (ASP)
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Beginning Active Server Pages Barry Sosinsky Valda Hilley Programming.
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
1 Web Servers (IIS and Apache) Outline 9.1 Introduction 9.2 HTTP Request Types 9.3 System Architecture 9.4 Client-Side Scripting versus Server-Side Scripting.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
1 Web Server Concepts Dr. Awad Khalil Computer Science Department AUC.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Project Four Forms Discuss form processing Describe the difference between client-side and server-side form processing Add a horizontal rule to a Web page.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 33 - Active Server Pages (ASP) Outline 33.1 Introduction 33.2 How Active Server Pages Work 33.3.
3/8/00asp00 1 Active Server Pages from Microsoft Nancy McCracken Northeast Parallel Architectures Center at Syracuse.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
Elements of ASP Documents Adapted from MCDN Web Workshop ( and Webmonkey’s Introduction to Active.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 21 - Web Servers (IIS, PWS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Introduction to Applets CS 3505 Client Side Scripting with applets.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Review of Client Server Model Notes courtesy of Deitel, Deitel and Nieto, (2001) e-Business and e-Commerce: How to Program, PrenticeHall. Dr. Kleist.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Website Development with PHP and MySQL Saving Data.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Active Server Pages Server-Side Scripting and Client-Side Scripting.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 26 – Active Server Pages (ASP) Outline 26.1Introduction 26.2How Active Server Pages Work.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
Client-side & Server-side Scripting ©Richard L. Goldman August 5, 2003 Requires PowerPoint 2002 or later for full functionality.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 25 - Active Server Pages (ASP) Outline 25.1 Introduction 25.2 How Active Server Pages Work 25.3.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
Introduction and Principles Web Server Scripting.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP (COMPONENTS) Active Server Pages (cont..) 1. global.asa file The Global.asa file is an optional file that can contain declarations of objects, variables,
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Chapter 33 - Active Server Pages (ASP)
Chapter 27 WWW and HTTP.
Presentation transcript:

Active Server Pages (ASP) 1

2 Introduction Active Server Pages (ASP) –Server-side text file –Processed in response to client request –Pages are processed by an ActiveX Component, called scripting engine –ASP file contains HTML and scripting code –VBScript de facto language for ASP scripting Other languages can be used –JavaScript –.asp file extension –Microsoft-developed technology

3 Introduction –Send dynamic Web content from a server to a client HTML DHTML ActiveX controls Client-side scripts Java applets Server-side scripting use the following information to dynamically create Web pages –Information sent by clients –Information stored on the server –Information stored in the server’s memory –Information from the Internet

4 How Active Server Pages Work Client sends request –Server receives request and directs it to ASP –ASP processes, then returns result to client HTTP request types –Request methods GET –Gets (retrieves) information from server –Retrieve HTML document or image –Send form content as part of the URL » POST –Posts (sends) data to server –Send info from HTML form

5 How Active Server Pages Work Browsers often cache Web pages –Cache: save on disk –Typically do not cache POST response Next POST request may not return same result E.g., uses use the same page for survey, each user’s response changes the overall results of the survey Client requests ASP file –Parsed (top to bottom) by ActiveX component asp.dll –Parsed each time requested –Web server must support ASP by providing component such as asp.dll

6 Client-side Scripting versus Server-side Scripting Client-side scripting –Commonly used for Validation Interactivity Accessing the browser Enhancing a Web page with ActiveX control, Dynamic HTML and Java applets –Browser-dependent Scripting language must be supported by browser or scripting host –Viewable on client Protecting source code difficult –Reduces the number of requests the server receives Because of validation of scripting –Enhance a Web page’s content Richer functionality than HTML

7 Client-side Scripting versus Server-side Scripting Server-side scripting –Reside on server –Greater flexibility – database access –Usually generate custom response for client E.g., dynamic generate the most current flight schedule when requested by a client –Access to ActiveX server components Extend scripting language functionality –Run exclusively on server Cross-platform issues not a concern –Not visible to client Only HTML + client-side scripts sent to client

Client-side Scripting versus Server-side Scripting An HTTP document can contain both client-side script (e.g., JavaScript) and server-side script (e.g., VBScript) 8

9 Using Personal Web Server or Internet Information Server ASP requires –Web server Personal Web Server (PWS) 4.0 Internet Information Server (IIS) 4.0 –Database –. mdb files –May have to change paths in.asp files to reflect your directory structure

10 Active Server Page Objects ASP has several built-in objects –Request object Access information passed by GET or POST Used to access cookies –Response object Sends information such as HTML or text to client –Server object Provides access to server methods and properties Provides method CreateObject –Used to instantiate other objects

11 A Simple ASP Example Scripting delimiters – –Indicate code is to be executed on server, not –Specify scripting language (default VBScript) – Each time page refreshed, server loads and interprets ASP

Outline 1.1Specify VBScript as scripting language 1.2Use Option Explicit to indicate variables be explicitly declared by programmer 1.3Use META tag to set refresh interval Time gets current time on server (hh:mm:ss) Short for A Simple ASP Example Simple ASP Example

13 Output from a simple Active Server Page

14 Server-side ActiveX Components Server-side ActiveX components –ActiveX controls that yypically do not have GUI –If scripting language for ASP not support certain feature, create ActiveX Server component Visual C++, Visual Basic, Delphi, etc. –Usually execute faster than scripting language equivalents –Executed on server Client does not need to support ActiveX technologies

15 Some server-side ActiveX components included with IIS and PWS

Outline 1.1Create instance of AdRotator component 1.2Call Response object’s Write method to send advertisement to client AdRotator Example AdRotator Example 14 15<% 16 ' Declare flagChanger 17 Dim flagChanger ' Create an AdRotator object 20 Set flagChanger = Server.CreateObject( "MSWC.AdRotator" ) ' Use config.txt to send an advertisement to the client 23 Call Response.Write( _ 24 flagChanger.GetAdvertisement( "config.txt" ) ) 25%> 26 27

Outline config.txt 1.Header includes image HEIGHT, image WIDTH and image BORDER width Asterisk separates header from advertisements Image location Destination URL ALT tag Percentage of time image appears 31BORDER 1 32* 33/images/us.gif 34http:// 35United States Information /images/france.gif 38http:// 39France Information /images/germany.gif 42http:// 43Germany Information /images/italy.gif 46http:// 47Italy Information /images/spain.gif 50http:// 51Spain Information REDIRECT redirect.asp 29WIDTH 54 30HEIGHT 36

18 HTML sent to client by rotate.asp Note this has been edited for presentation 53<A HREF = "redirect.asp?url= 54 factbook/us.html&image=/images/us.gif"> 55<IMG SRC = "/images/us.gif" ALT = "United States Information" 56 WIDTH = "54" HEIGHT = "36" BORDER = "1">

19 Demonstrating the AdRotator ActiveX component

20 File System Objects File System Objects (FSOs) –Manipulate files, directories and drives –Read and write text –In Microsoft Scripting Runtime Library –5 FSO types: FileSystemObject –Interact with File s, Folder s and Drive s File –Manipulate File s of any type Folder –Manipulate Folder s (i.e, directories) Drive –Gather info about Drive s (local or remote) TextStream –Read and write text files

21 File System Objects OpenTextFile(filename, code, create) –filename - file to open –code 8 - open for appending 1 - open for reading 2 - open for writing –create? - if true, creates a new file if does not exist

22 FileSystemObject methods

23 Some common File properties and methods

24 Some Folder properties and methods

25 Drive properties

Outline 1.1Test if entry variable “true” ; when page first requested has value “” ; passed value “true” during POST operation 1.2 Create FSO instance GuestBook Example <% 14 Dim fileObject, textFile, guestBook, mailtoUrl ' If user has made an entry and thus the page is 17 ' reloading, then process this entry 18 If Request( "entry" ) = "true" Then ' Print a thank you 21 Call Response.Write( "Thanks for your entry, " ) 22 Call Response.Write( Request( "name" ) & "!" ) 23%> 24 25<% ' Instantiate a FileSystemObject 26 Set fileObject = Server.CreateObject( _ 27 "Scripting.FileSystemObject" ) ' Guestbook path must be modified to reflect the file 30 ' structure of the server. 31 guestBook = "c:\Inetpub\Wwwroot\Deitel\" & "guestbook.txt" ' Check if the file exists. If not, create it.

Outline 1.3 Specify POST operation 34 If fileObject.FileExists( guestbook ) <> True Then 35 Call fileObject.CreateTextFile( guestBook ) 36 End If ' Guestbook must be open for writing. 39 ' Open the guestbook, 8 is for appending 40 Set textFile = fileObject.OpenTextFile( guestbook, 8, True ) ' Build the mailtoUrl 43 mailtoUrl = Date() & " <A HREF = " & Chr( 34 ) _ 44 & "mailto:" & Request( " " ) & Chr( 34 ) _ 45 & ">" & Request( "name" ) & " : " ' Write data to guestbook.txt 48 Call textFile.WriteLine( "<HR COLOR = " & Chr( 34 ) _ 49 & "blue" & Chr( 34 ) & " SIZE = " & Chr( 34 ) _ 50 & "1" & Chr( 34 ) & ">" ) 51 Call textFile.WriteLine( mailtoUrl ) 52 Call textFile.WriteLine( Request( "comment" ) ) 53 Call textFile.Close() 54 End If 55%> 56 57Please leave a message in our guestbook Your Name: 65 <INPUT TYPE = "text" FACE = "Arial" 66 SIZE = "60" NAME = "name">

Outline 1.5 Load FSO Your address: <INPUT TYPE = "text" FACE = "Arial" SIZE = "60" 72 NAME = " " VALUE = Tell the world: Replace this text with the information 79you would like to post <% 89 Dim fileObject2, textFile ' Instantiate a FileSystemObject 92 Set fileObject2 = Server.CreateObject( _ 93 "Scripting.FileSystemObject" ) ' Guestbook path must be modified to reflect 96 ' the file structure of the server. 97 guestBook = "c:\Inetpub\wwwroot\Deitel\" & "guestbook.txt" ' Check if the file exists. If not, create it.

Outline 1.6 Display contents of guestbook.txt 100 If fileObject2.FileExists( guestBook ) = True Then ' Guestbook must be open for writing. 103 ' Open the guestbook, "1" is for reading. 104 Set textFile2 = fileObject2.OpenTextFile( guestbook, 1 ) ' Read the entries from the file and write them to 107 ' the client. 108 Call Response.Write( "Guestbook Entries: " ) 109 Call Response.Write( textFile2.ReadAll() ) 110 Call textFile2.Close() 111 End If 112%>

30 Guest book Active Server Page