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.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

E-Commerce CMM503 – Lecture 8 Stuart Watt Room C2.
Java Script Session1 INTRODUCTION.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
Session 13 Active Server Pages (ASP) Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
Languages for Dynamic Web Documents
1 Chapter 12 Working With Access 2000 on the Internet.
1 Today: Introduction to ASP- Part 1 Explain the client/server architecture Explain Web-based client/server applications Understand the essentials of Active.
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.
CVEV 118/698 Active Server Pages Lecture 3 Prof. Mounir Mabsout Elsa Sulukdjian Walid El Asmar.
1 ASP-Code Examples if....then....else end if for next do while loop database response.write “ “
INTERNET DATABASE. Internet and E-commerce Internet – a worldwide collection of interconnected computer network Internet – a worldwide collection of interconnected.
Introduction to Active Server Pages
4/8/99 C. Edward Chow Page 1 Active Server Page It is a server-side scripting environment for creating dynamic content. ASP are files with.asp extension,
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
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.
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.
MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples.
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
3/8/00asp00 1 Active Server Pages from Microsoft Nancy McCracken Northeast Parallel Architectures Center at Syracuse.
Server Side Programming ASP1 Server Side Programming Database Integration (cont.) Internet Systems Design.
Elements of ASP Documents Adapted from MCDN Web Workshop ( and Webmonkey’s Introduction to Active.
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,
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Web Design and Development for E-Business By Jensen J. Zhao Copyright 2003 Prentice Hall, Inc. Web Design and Development for E-Business Jensen J. Zhao.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Tutorial 10 Programming with JavaScript
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
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.
EIW - ASP Introduction1 Active Server Pages VBScript.
7 Chapter Seven Client-side Scripts. 7 Chapter Objectives Create HTML forms Learn about client-side scripting languages Create a client-side script using.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
The Problem of State. We will look at… Sometimes web development is just plain weird! Internet / World Wide Web Aspects of their operation The role of.
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.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
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-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.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
eCommerce Technologies Syntax & Procedures for Markup MIS Spring 2004 Instructors: Kelly Fish, Ph.D. John Seydel, Ph.D.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
CGS 3066: Web Programming and Design Spring 2016 PHP.
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.
Active Server Pages v.s. Java Server Pages Presenters: Lan Guo Qunying Fan Pei-Xun Wu Date:
ASP Mr. Baha & Dr.Husam Osta  What is ASP?  Internet Information Services  How Does ASP Differ from HTML?  What can ASP do for you?  ASP Basic.
ASP – Web Programming Class  Ravi Anand. ASP – Active Server Pages What is ASP? - Microsoft Technology - Can Run using IIS/PWS/Others - Helps us create.
PHP using MySQL Database for Web Development (part II)
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
PHP / MySQL Introduction
The Request & Response object
Client side & Server side scripting
Presentation transcript:

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 or what is viewing it. If the Web browser that receives it, an Active Server Page looks just like a normal HTML page. However, the file located in the server looks very different. In addition to text and HTML tags, you also see server-side scripts. This is what the Active Server Page looks like to the Web server before it is processed and sent in response to a request.

2 How ASP Works? 1.User brings up a Web site where the default page has the extension.asp. 2.The browser requests the ASP file from the Web server 3.The server-side scripts begins to run with ASP. 4.ASP processes the requested file sequentially (top-down), executes any script command contained in the file, and produces an HTML Web page. 5.The Web page is sent to the browser.

3 ASP vs HTML ASP = HTML + some other stuff! What is the difference? Basically we are taking the HTML and adding some elements... ASP files end with the.asp extension, so the Web server knows what it is. ASP files include server-side code that contain instructions for the server. Browser can not display your code! ASP files provide dynamic information

4 Active Server Pages Server-side scripts ~ HTML tags. ~ You can insert server-side scripts anywhere in your Web page-- even inside HTML tags. The server looks inside the ASP tags and runs the instructions, sends the results

5 Vbscript - Scripting Language Default Language of ASP  VbScript (no need to write!) ASP  JavaScript General Syntax:

6 ASP Objects 1.Request object, 2.Response object, 3.Server object, 4.Session object, 5.Application Object. It connects, or relates, these objects to ActiveX Data Objects (ADO) Connection object, Recordset object, Command Objects.

7 ASP – Request Object gets information from client browsers submits it to the Web server  It provides the following basic data collection functions;  Form (collects data from fill-in forms by using post method)  QueryString (same;but the method is get. Appends data to the URL given in the Action attribute of a form)  ServerVariables (generates HTTP and server information about a visitor’s site)  Cookies (stored as small text files on client computers  retrieved by the Web server each time the client browser opened.)

8 Examples – Request Object <% for each SV in Request.ServerVariables response.write " " & SV & " = " & Request.ServerVariables(SV) & " " next %> <% for each item in Request.Cookies response.write " " & Cookie & "=" & Request.Cookies(item) & " " next %>

9 ASP – Response Object takes information from Web server sends to the client browsers redirects the browser to the different URL sends cookies to the browser Examples; ” %>

10 ASP-Server Object Sets the maximum amount of time a script can run before it times out Takes a string and either HTML or URL encode it Converts a virtual web address to an absolute path on the server <% set connection = Server.CreateObject(“ADODB.Connection”) %>

11 ASP-Session Object The process of a Web user’s visit through the pages is called a session. Used to identify users of the application Useful for site counters and for login The Web server automatically creates the Session object.

12 ASP-Application Object Used to store and share information that can be used on the entire application. To store Web address; ”>Home Page To store the database connection string; <% conn341 = “DRIVER = {Microsoft Access Driver (*.mdb)};” conn341 = conn341 & “DBQ =“ & ServerMapPath(“dbase/db341.mdb”) Application(“connection”) = conn341 %> <% Set conn = Server.CreateObject(“ADODB.Connection”) Conn.Open Application(“connection”) %>

13 ADO - ActiveX Data Objects ADOs provide a mechanism for the Web-based client/server application to access various databases. ADOs are designed to interface with the relational databases through the Open Database Connectivity (ODBC). ADO includes 3 objects;  Connection object,  Recordset object,  Command object.

14 Database ASP and ADO Object Model Structure Client Browser Web serverData server Request object Response object Server object Application Object ActiveX data object (ADO) ODBC Driver System DSN Session object

15 Variables Every application uses variables, and ASP scripts are no exception! But there is no obligation in Visual Basic and VbScript No need to define the variables and variable types at the beginning of the program. But if you want you can... If you add the following line after the language info to the page; You must declare your variables.  i.e. dim number1 dim number2

16 Variables Basic Variable Types: numeric, alpha-numeric, and logical. No need to know other variable types, because when you assign a value to a variable, Visual Basic understands your variable type! variable_1 = 15 variable_2 = “15” variable_3 = true If you want to learn type of any variable; <% variable_1 = 15 Response.write vartype(variable_1) ‘it writes 2 to the page %> List of Variant type variables of the VBScript vbNull 1 contains no data, vbInteger 2 integer type, vbLong

17 VBScript Looping – flow controls Looping constructs provide the foundation for any application that must repetitively perform a task. Such as adding 1 to a variable, reading a text file, or processing an message. VBScript and Jscript provide several looping mechanism. For... Next, For each... in...Next, Do.. Loop While, Do...While...Loop, Do..Until...Loop, Do...Loop Until..., While...Wend conditional operators Conditional operators, together with variables and looping constructs, for the fundamental building blocks of applications. Such as sending a page to the client browser that consists of the current time and date and a greeting If..Then, If...then...else, If...then...Elseif...then else, Select...Case, Switch..case

18 How to Create ASP Pages? 1.Create your web page - basic design - with MS Frontpage 2.Switch to HTML tab. 3.Add ASP codes into their respective places. 4.Save your file with the extension.asp. 1.Design the followings in FrontPage:

19 How to Create ASP Pages ? 2.Switch to HTML tab.

20 How to Create ASP Pages? 3.Add ASP codes into their respective places.

21 Reponse.Write ( ) Response object is the part of ASP that handles responding to the request of a browser If you want to display information to Web page Write method of the response object will be used. <% Response.Write(“Hello World”) %> NOTE : equal sign (=) is a short-cut of response.write object

22 How to Save ASP Pages? 4.Save your file with the extension.asp. Write asp extension with the file name. Select Active Server Pages option as file type. So, you do not need to write file extension. OR

23 How to transfer to the Server?

24 How to Display ASP Pages?

25 Another example! (“for – next”) We want to write “hosgeldiniz” in 5 different font size!

26 Handling HTML codes in ASP codes ” %> htmlTuna Tuna Tuna Tuna response.write “ Tuna “ typeMismatch

27 response.write response.write “ Tuna “ Handling Error: 1 st way: Do not use “ “ in HTML! But;  face = lucida ? <% response.write %> ? 2 nd way: use ‘ ‘ instead of “ “ Examples: Example 1:Adding 2 numbers <% num1 = 40 num2 = 30 response.write num1 + num2 %>

28 response.write Example 2:finding y <% num1 = 10 num2 = 20 sq1 = num1 * num1 sq2 = num2 * num2 sum = num1 + num2 response.write sq2 &","& sq1 & "," & sum Example 3:finding the square of 2 numbers and the addition of their square

29 response.write & if..then..else..end if Example 4:VAT included Price 0 THEN response.write num &" "& "is a positive number.“ ELSE response.write num &" "& "is a negative number.“ END IF %> Example 5:positive or negative?

30 response.write & if..then..else..end if Example 6: If a number less than 10, output it's square otherwise the number only. 10 THEN sq = num * num response.write sq ELSE response.write num END IF %> num2 THEN num = num1 - num2 ELSE num = num2 - num1 END IF Response.Write num %> Example 7: Subtract the smaller from the larger

31 response.write & if..then..else..end if Example 8: SNG room 100$ others 150$> Example 9: PASS, FAIL = 50 THEN Response.Write "PASS“ ELSE Response.Write "FAIL“ END IF %>