Chapter 25 – Active Server Pages (ASP) Outline 25.1 Introduction 25.2 How Active

Chapter 25 - Active Server Pages (ASP) Outline 25.1 Introduction 25.2 How Active www.phwiki.com

Chapter 25 – Active Server Pages (ASP) Outline 25.1 Introduction 25.2 How Active

Vanderpool, Tim, Freelance Writer has reference to this Academic Journal, PHwiki organized this Journal Chapter 25 – Active Server Pages (ASP) Outline 25.1 Introduction 25.2 How Active Server Pages Work 25.3 Setup 25.4 Active Server Page Objects 25.5 Simple ASP Examples 25.6 File System Objects 25.7 Session Tracking in addition to Cookies 25.8 Accessing a Database from an Active Server Page 25.9 Server-Side ActiveX Components 25.10 Internet in addition to World Wide Web Resources 25.1 Introduction Server-side technologies Dynamically creates Web pages Uses client in as long as mation, server in as long as mation in addition to in as long as mation from the Internet Active Server Pages (ASP) Microsoft Server-side technology Dynamically builds documents in response to client requests Delivers dynamic Web content XHTML, DHTML, ActiveX controls, client-side scripts in addition to Java applets 25.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 in addition to returns results

Arkansas State University, Beebe US www.phwiki.com

This Particular University is Related to this Particular Journal

25.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) 25.3 Setup Web Server Need to run Web server to use Active Server Pages IIS (Internet In as long as mation Services) or PWS 4.0 (Personal Web Server 4.0) Create a virtual directory Copy files to c:InetPubWwwroot or c:WebshareWwwroot 25.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 in as long as mation Data provided by the user in an XHTML as long as m Access to in as long as mation stored on client machine Cookies File upload (binary) Response Sends in as long as amtion to client XHTML, text Server Access to server methods or properties

25.4 Active Server Page Objects Clock.asp sends Web server’s date in addition to time to the client as XHTML markup <% %> scripting delimeter @LANGUAGE processing directive Option Explicit FormatDateTime Now vbLongDate as long as mat Response.write Time 1 <% @LANGUAGE = VBScript %> 2 3 <% 4 ' Fig. 25.2 : clock.asp 5 ' A simple ASP example 6 Option Explicit 7 %> 8 9 11 12 13 14 15 A Simple ASP Example 16 17

24 25 26 27 28 29 A Simple ASP Example 30

31

32

35 Clock.asp Time Program Output 36

39

40

33 <% =FormatDateTime( Now, vbLongDate ) %> 34 37 <% =Time() %> 38

41 42 43

Fig. 25.3 XHTML generated by clock.asp. 1 3 4 5 6 7 A Simple ASP Example 8 9

16 17 18 19 20 21 A Simple ASP Example 22

23

24

27 28

31

32

25 Thursday, May 24, 2001 26 29 2:22:58 PM 30

33 34 35 25.5 Simple ASP Examples ASP processes input Form in as long as mation sent by client E-commerce Web site Use to verify customer in as long as mation Server responds to process request Form Using post method action attribute indicates the .asp file to which the as long as m in as long as mation is posted request object retrieves as long as m data Name.html passes in as long as mation into an ASP document using the post method. 1 3 4 5 6 7 8 9 10 Name Request 11 12 13 14 15

16 Enter your name: 17 18 19 20 < as long as m action = "name.asp" method = "post"> 21 22 24 25 26 27 28

Name.html Program Output Name.asp Uses the Request method to retrieve the data posted in Name.html. Places this data within XHTML tags as long as output. 1 <% @LANGUAGE = VBScript %> 2 3 <% 4 ' Fig. 25.5 : name.asp 5 ' Another simple ASP example 6 Option Explicit 7 %> 8 9 11 12 13 14 15 Name In as long as mation 16 17

22 23 24 25 26 27 Hi <% =Request( "namebox" ) %>,
28

Welcome to ASP! 29 30 31 32 Name.asp Program Output

25.6 File System Objects File System Objects (FSOs) Allow programmer to manipulate files, directories in addition to drives Read in addition to write text Microsoft Sctipting Runtime Library (Fig 25.6) FileSystemObject, File, Folder, Drive in addition to TextStream Use to create directories, move files, determine whether a Drive exists FileSystemObject methods (Fig. 25.7) File object Allows programmer to gather info about files, manipulate files, open files File properties in addition to methods (Fig. 25.8) 25.6 File System Objects 25.6 File System Objects

25.6 File System Objects 25.6 File System Objects 25.6 File System Objects File System Objects (FSOs) Path property Contains File path in long name as long as mat ShortName property Contains File path in short name as long as mat Folder object Allows programmer to manipulate in addition to gather info about directories Folder properties (Fig. 25.9)

25.6 File System Objects 25.6 File System Objects 25.6 File System Objects File System Objects (FSOs) IsRootFolder property Indicates whether folder is the root folder as long as the Drive If not: Method ParentFolder Retrieves parent folder Method Size Returns the total bytes the folder contains (includes subfolders)

Vanderpool, Tim Tucson Weekly Freelance Writer www.phwiki.com

25.6 File System Objects File System Objects (FSOs) Drive object (Fig. 25.10) Gather in as long as mation about drives Property DriveLetter Contains drive letter Property SerialNumber Contains drive serial number Property FreeSpace Contains number of available bytes 25.6 File System Objects 25.6 File System Objects File System Objects (FSOs) TextStream object (Fig. 25.11) Manipulate text files

25.6 File System Objects 25.6 File System Objects 25.6 File System Objects

Config.txt Describes the advertisements 1 REDIRECT redirect.asp 2 width 54 3 height 36 4 border 1 5 6 /images/us.gif 7 http://www.odci.gov/cia/publications/factbook/geos/us.html 8 United States In as long as mation 9 20 10 /images/france.gif 11 http://www.odci.gov/cia/publications/factbook/geos/fr.html 12 France In as long as mation 13 20 14 /images/germany.gif 15 http://www.odci.gov/cia/publications/factbook/geos/gm.html 16 Germany In as long as mation 17 20 18 /images/italy.gif 19 http://www.odci.gov/cia/publications/factbook/geos/it.html 20 Italy In as long as mation 21 20 22 /images/spain.gif 23 http://www.odci.gov/cia/publications/factbook/geos/sp.html 24 Spain In as long as mation 25 20 Redirect.asp Redirects user to country’s CIA page when ad is clicked 1 <% @LANGUAGE = VBScript %> 2 3 <% 4 ' Fig. 25.30 : redirect.asp 5 ' Redirection Page as long as AdRotator Component 6 Option Explicit 7 8 Call Response.Redirect( Request( "url" ) ) 9 %>

Vanderpool, Tim Freelance Writer

Vanderpool, Tim is from United States and they belong to Tucson Weekly and they are from  Tucson, United States got related to this Particular Journal. and Vanderpool, Tim deal with the subjects like Environment; Human Interest; Local News; Regional News

Journal Ratings by Arkansas State University, Beebe

This Particular Journal got reviewed and rated by Arkansas State University, Beebe and short form of this particular Institution is US and gave this Journal an Excellent Rating.