Presentation is loading. Please wait.

Presentation is loading. Please wait.

Elements of ASP Documents Adapted from MCDN Web Workshop (http://msdn.microsoft.com/workshop/server/asp/ASPover.asp) and Webmonkey’s Introduction to Active.

Similar presentations


Presentation on theme: "Elements of ASP Documents Adapted from MCDN Web Workshop (http://msdn.microsoft.com/workshop/server/asp/ASPover.asp) and Webmonkey’s Introduction to Active."— Presentation transcript:

1 Elements of ASP Documents Adapted from MCDN Web Workshop (http://msdn.microsoft.com/workshop/server/asp/ASPover.asp) and Webmonkey’s Introduction to Active Server Page (http://hotwired.lycos.com/webmonkey/98/39/index2a.html)http://msdn.microsoft.com/workshop/server/asp/ASPover.asphttp://hotwired.lycos.com/webmonkey/98/39/index2a.html

2 Server Side Scripting Javascript: universally used on the browser for client side scripting. php, pearl, ASP, ASP.NET, JSP: used for client side scripting. Client side scripting can capture input from client forms and write email; connect to DB, search DB, and return information to clients.

3 What is Active Server Page? A specification for a dynamically created Web page. When the browser requests an ASP document, the server creates an HTML page on the fly and sends it to the client. ASP refers to: Microsoft technology for Server-side scripting Can combine HTML, VBScript, Javascript, ADO Web document that contains ASP code Has extension.asp

4 What Can You Do with ASP? Put Employee records on-line, so that they can be updated by individuals--e.g., health plan Tie on-line store to existing inventory database Allow visitor to a Web site for only that information the person seeks

5 ASP Cycle BrowserServer ASP Engine Com Objects 1 4 5 72 6 3 1. Browser requests ASP page from server 2. Server sends ASP page to ASP engine 3. ASP engine executes server- side scripts 4. ASP calls for COM* objects (when needed) 5. COM object retrieved (when asked) 6. ASP engine sends HTML stream to server 7. Server sends HTML code to browser *COM: Component Object Model—MS-developed standards to allow programmers to access OLE and Active X objects

6 ASP Statements ASP uses the delimiters " " to enclose script commands. For example, the following code sets the value of the variable "MyFavTVShow" in the user cookie to "I Dream of Jeannie."

7 Code Example 1 = #12:00:00 AM# And Time Good Morning! Hello! The following code segment prints appropriate greeting to a Web page depending on the time of day.

8 Built-in Objects ASP includes five standard objects for global use: Request—to get information from the user Response—to send information to the user Server—to control the Internet Information Server Session—to store information about settings and change them for the user's current Web-server session Application—to share application-level information and control settings for the lifetime of the application

9 Methods for Response Object AddHeader—Adds an HTML header with a specified value AppendToLog—Appends a string to the end of the Web server log file BinaryWrite—writes binary data (i.e, Excel spreadsheet data) Clear—clears any buffered HTML output. End—stops processing of the script. Flush — sends all of the information in the buffer. Redirect—to redirect the user to a different URL Write—to write into the HTML stream.

10 Writing to HTML Document or the shortcut command

11 Methods for Server Object CreateObject—to create an instance of a server component. This component can be any component that you have installed on your server (such as an ActiveX ). HTMLEncode—to encode the specified string in HTML. MapPath—to map the current virtual path to a physical directory structure. You can then pass that path to a component that creates the specified directory or file on the server. URLEncode—applies URL encoding to a specified string.

12 Code Example 2 Test an ASP <body bgcolor="cccc66" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> This part is from HTML. This is another line from VBScript. ") %> Click here for result

13 Click here for HTML code

14


Download ppt "Elements of ASP Documents Adapted from MCDN Web Workshop (http://msdn.microsoft.com/workshop/server/asp/ASPover.asp) and Webmonkey’s Introduction to Active."

Similar presentations


Ads by Google