SlideShare une entreprise Scribd logo
1  sur  17
ACTIVE SERVER PAGES
Active Server Pages (ASP), also known as Classic ASP
or ASP Classic, was Microsoft's first server-side script
engine for dynamically generated web pages. Initially
released as an add-on to Internet Information Services
(IIS) via the Windows NT 4.0 Option Pack, it was
subsequently included as a free component of Windows
Server. ASP.NET has superseded ASP.
The Active Scripting engine's support of the
Component Object Model (COM) enables ASP websites
to access functionality in compiled libraries such as
DLLs.
 The use of ASP pages with Internet Information Services
(IIS) is currently supported on all supported versions of
IIS.
 Web pages with the .asp file extension use ASP, although
some web sites disguise their choice of scripting
language for security purposes Pages with the .aspx
extension use compiled ASP.NET which makes them
faster and more robust than server-side scripting in ASP,
which is interpreted at run-time; however, ASP.NET
pages may still include some ASP scripting. The
introduction of ASP.NET led to use of the term Classic
ASP for the original technology.
VBSCRIPT
 Using VBScript in ASP pages is very simple. The interpreter
replaces all the code in between the <% and %> tags. In the
example below Response.Write Now() dynamically replaced
by the current time of the server.
 <html>
 <head>
 <title>Kaushik Enterprises</title>
 </head>
 <body>The server's current time:<br />
 <%
 Response.Write Now()
 %>
 </body>
 </html>
VBScript is not case sensitive
 foo is the same thing as FOO
 This applies to everything
 variable names, constant names
 keywords
 subroutine/function names
 object names
VBSCRIPT VARIABLES
 Data type: variant
 can be anything (much like JavaScript & Perl).
 Some people name variables according to how they
will be used:
 intFoo Foo is an int
 strFoo Foo is a string
 objFoo Foo is an object
VARIABLE SCOPE
Variables declared outside of a
subroutine or function (VBScript has
both) are global.
Variables declared in a subroutine or
function are created and destroyed
each time the procedure is called.
(local variables)
THE ACTIVE SERVER PAGES MODEL
• An ASP script begins to run when a browser requests
a .asp file from your Web server.
• Web server then calls ASP, which reads through the
requested file from top to bottom, executes any ASP
statements, and sends an HTML page to the browser.
ASP ARCHITECTURE
ASP SCRIPTING
• The first line in an .asp file specifies the scripting
language for the page. For example, the following
first line in .asp file specifies that the script is
VBScript:
<%@ LANGUAGE=VBScript %>
• Without a language tag, script in the file is processed
as the default language (VBScript by default.) under
the ASP entry in the Web server registry.
• Active Server Pages can provide a scripting
environment for a number of other scripting
languages, including Jscript (build-in), REXX, and
Perl, and others.
DEVELOPING ASP SCRIPTS
Creating/Revising ASP scripts
Posting ASP scripts on the web server or
saving them on the local web server
Testing ASP Scripts
SETTING UP ASP FILES
• An Active Server Pages (ASP) file is a text file with the
extension .asp that contains any combination of the following:
– Text
– HTML tags
– ASP script commands
– Call to ActiveX server components
• ASP is server-side scripting.
• ASP files only work with the IIS on NT or PWS on Windows
95.
• .asp files should be saved on your Web site in a directory that
has Script or Execute permission enabled.
DATA TYPES
• Variables: Simple variables and Array variables
• VBScript subsumes all categories of data under one name called a Variant.
• At a basic level, Variants contain either string or numeric data.
• String data is used for text, while numeric data contains only numbers.
• Variant data can be further classified into subtypes. For example, you can
have numeric data that represents currency, or a date or time, and the
Variant will interpret the data accordingly.
• You can use the data type conversion function for data type conversion. For
example, CInt function to force conversion of an expression to the Variant
of subtype Integer.
DECLARING VARIABLES
 VBScript implicitly creates a variable the first time that it
encounters an unrecognized string of characters that could be a
variable name.
 The Option Explicit statement informs VBScript to generate an
error if it encounters an undeclared variable. The Option Explicit
statement should be the first line of code in a script that uses
variables.
 Dim varname[([subscripts])][, varname[([subscripts])]] . . .
 Dim a, x(10), y(2, 5)
 A variable name:
 Must begin with an alphabetic character.
 Cannot contain an embedded period.
 Must not exceed 255 characters.
 Must be unique.
 Is not case-sensitive.
USE PROCEDURES TO STRUCTURED CODE
 Structured code consists of compact chunks of related code that are
termed procedures.
 Procedures are reusable code that can be called from anywhere in
your script.
 The main benefits of structured coding are as follows:
 Maintenance—when related code is grouped, it is easier to
maintain. When code needs to be updated or modified, you can
make the changes in a single code segment rather than
throughout an entire program.
 Debugging—because the code is modular, you can pinpoint
where an error occurs and conduct your debugging efforts in the
code segment where the error occurred.
 Reusability—you can call the procedures from anywhere in
your script, as well as use the code segments in other programs
that require the same procedures.
SCOPE OF A VARIABLE
• If a variable is declared outside of a procedure, it is
visible throughout the program.
• If a variable is declared inside a procedure, it is only
visible inside that procedure.
• The range of a variable’s visibility is called its scope.
• In VBScript:
– Scope is either script-level or procedure-level.
– A variable is in effect within its scope.
– Variable names must be unique within their scope.
– Variables should always be defined with the smallest scope possible.
WHAT IS AN OBJECT?
• An object is simply a collection of functions and data
grouped together. Typically, most of the object’s
functionality (particularly its data structure) is hidden
from the programmer, who uses the object’s interface, or
model, to control the object. The object’s interface
consists of a published set of functions and data. In pure
object-oriented systems, data are private and therefore
cannot be accessed by external object directly.
• Methods: The procedures that an object exposes through
its interface are called methods. Methods are typically
functions and return a value.
 Properties: The variables that are part of an object are
called properties:
 Reading a property’s value is called getting the property’s value.
 Writing a value to a property is called setting the property’s value.
 Properties can be read-only or read/write depending on the design of
the object.

Contenu connexe

Tendances

CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By PalashPalashBajpai
 
Content Management System - CMS
 Content Management System - CMS Content Management System - CMS
Content Management System - CMSJaime Delgado
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web ApplicationRishi Kothari
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpcasestudyhelp
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!Syahmi RH
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basicsEliran Eliassy
 
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScriptDYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScriptSoumen Santra
 
Introduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptIntroduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptMuhammadRehan856177
 
Lecture-1: Introduction to web engineering - course overview and grading scheme
Lecture-1: Introduction to web engineering - course overview and grading schemeLecture-1: Introduction to web engineering - course overview and grading scheme
Lecture-1: Introduction to web engineering - course overview and grading schemeMubashir Ali
 
JavaScript - Chapter 3 - Introduction
 JavaScript - Chapter 3 - Introduction JavaScript - Chapter 3 - Introduction
JavaScript - Chapter 3 - IntroductionWebStackAcademy
 
presentation in html,css,javascript
presentation in html,css,javascriptpresentation in html,css,javascript
presentation in html,css,javascriptFaysalAhammed5
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NETRajkumarsoy
 

Tendances (20)

HTML Tags
HTML TagsHTML Tags
HTML Tags
 
CSS framework By Palash
CSS framework By PalashCSS framework By Palash
CSS framework By Palash
 
Basic html structure
Basic html structureBasic html structure
Basic html structure
 
Javascript 101
Javascript 101Javascript 101
Javascript 101
 
Content Management System - CMS
 Content Management System - CMS Content Management System - CMS
Content Management System - CMS
 
Developing an ASP.NET Web Application
Developing an ASP.NET Web ApplicationDeveloping an ASP.NET Web Application
Developing an ASP.NET Web Application
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!HTML, CSS And JAVASCRIPT!
HTML, CSS And JAVASCRIPT!
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScriptDYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
 
Introduction to JavaScript (1).ppt
Introduction to JavaScript (1).pptIntroduction to JavaScript (1).ppt
Introduction to JavaScript (1).ppt
 
Lecture-1: Introduction to web engineering - course overview and grading scheme
Lecture-1: Introduction to web engineering - course overview and grading schemeLecture-1: Introduction to web engineering - course overview and grading scheme
Lecture-1: Introduction to web engineering - course overview and grading scheme
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
DHTML
DHTMLDHTML
DHTML
 
JavaScript - Chapter 3 - Introduction
 JavaScript - Chapter 3 - Introduction JavaScript - Chapter 3 - Introduction
JavaScript - Chapter 3 - Introduction
 
presentation in html,css,javascript
presentation in html,css,javascriptpresentation in html,css,javascript
presentation in html,css,javascript
 
Html ppt
Html pptHtml ppt
Html ppt
 
Css
CssCss
Css
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 

Similaire à Active server pages (20)

Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.pptintroaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
introaspnetkjadbfksdjkfaskjdbfkajsbfkjfjkswa.ppt
 
introaspnet.ppt
introaspnet.pptintroaspnet.ppt
introaspnet.ppt
 
introaspnet.ppt
introaspnet.pptintroaspnet.ppt
introaspnet.ppt
 
Advanced+qtp+open+order
Advanced+qtp+open+orderAdvanced+qtp+open+order
Advanced+qtp+open+order
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Introduction to Visual Basic
Introduction to Visual Basic Introduction to Visual Basic
Introduction to Visual Basic
 
introasp_net-7364068.ppt
introasp_net-7364068.pptintroasp_net-7364068.ppt
introasp_net-7364068.ppt
 
introasp_net-6563550.ppt
introasp_net-6563550.pptintroasp_net-6563550.ppt
introasp_net-6563550.ppt
 
introaspnet-3030384.ppt
introaspnet-3030384.pptintroaspnet-3030384.ppt
introaspnet-3030384.ppt
 
introaspnet-5856912.ppt
introaspnet-5856912.pptintroaspnet-5856912.ppt
introaspnet-5856912.ppt
 
Introaspnet
IntroaspnetIntroaspnet
Introaspnet
 
Aspintro
AspintroAspintro
Aspintro
 
Learn ASP
Learn ASPLearn ASP
Learn ASP
 
ASP.NET Basics
ASP.NET Basics ASP.NET Basics
ASP.NET Basics
 
Visual studio
Visual studioVisual studio
Visual studio
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Vbs
VbsVbs
Vbs
 
js.pptx
js.pptxjs.pptx
js.pptx
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 

Active server pages

  • 1. ACTIVE SERVER PAGES Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages. Initially released as an add-on to Internet Information Services (IIS) via the Windows NT 4.0 Option Pack, it was subsequently included as a free component of Windows Server. ASP.NET has superseded ASP. The Active Scripting engine's support of the Component Object Model (COM) enables ASP websites to access functionality in compiled libraries such as DLLs.
  • 2.  The use of ASP pages with Internet Information Services (IIS) is currently supported on all supported versions of IIS.  Web pages with the .asp file extension use ASP, although some web sites disguise their choice of scripting language for security purposes Pages with the .aspx extension use compiled ASP.NET which makes them faster and more robust than server-side scripting in ASP, which is interpreted at run-time; however, ASP.NET pages may still include some ASP scripting. The introduction of ASP.NET led to use of the term Classic ASP for the original technology.
  • 3. VBSCRIPT  Using VBScript in ASP pages is very simple. The interpreter replaces all the code in between the <% and %> tags. In the example below Response.Write Now() dynamically replaced by the current time of the server.  <html>  <head>  <title>Kaushik Enterprises</title>  </head>  <body>The server's current time:<br />  <%  Response.Write Now()  %>  </body>  </html>
  • 4. VBScript is not case sensitive  foo is the same thing as FOO  This applies to everything  variable names, constant names  keywords  subroutine/function names  object names
  • 5. VBSCRIPT VARIABLES  Data type: variant  can be anything (much like JavaScript & Perl).  Some people name variables according to how they will be used:  intFoo Foo is an int  strFoo Foo is a string  objFoo Foo is an object
  • 6. VARIABLE SCOPE Variables declared outside of a subroutine or function (VBScript has both) are global. Variables declared in a subroutine or function are created and destroyed each time the procedure is called. (local variables)
  • 7. THE ACTIVE SERVER PAGES MODEL • An ASP script begins to run when a browser requests a .asp file from your Web server. • Web server then calls ASP, which reads through the requested file from top to bottom, executes any ASP statements, and sends an HTML page to the browser.
  • 9. ASP SCRIPTING • The first line in an .asp file specifies the scripting language for the page. For example, the following first line in .asp file specifies that the script is VBScript: <%@ LANGUAGE=VBScript %> • Without a language tag, script in the file is processed as the default language (VBScript by default.) under the ASP entry in the Web server registry. • Active Server Pages can provide a scripting environment for a number of other scripting languages, including Jscript (build-in), REXX, and Perl, and others.
  • 10. DEVELOPING ASP SCRIPTS Creating/Revising ASP scripts Posting ASP scripts on the web server or saving them on the local web server Testing ASP Scripts
  • 11. SETTING UP ASP FILES • An Active Server Pages (ASP) file is a text file with the extension .asp that contains any combination of the following: – Text – HTML tags – ASP script commands – Call to ActiveX server components • ASP is server-side scripting. • ASP files only work with the IIS on NT or PWS on Windows 95. • .asp files should be saved on your Web site in a directory that has Script or Execute permission enabled.
  • 12. DATA TYPES • Variables: Simple variables and Array variables • VBScript subsumes all categories of data under one name called a Variant. • At a basic level, Variants contain either string or numeric data. • String data is used for text, while numeric data contains only numbers. • Variant data can be further classified into subtypes. For example, you can have numeric data that represents currency, or a date or time, and the Variant will interpret the data accordingly. • You can use the data type conversion function for data type conversion. For example, CInt function to force conversion of an expression to the Variant of subtype Integer.
  • 13. DECLARING VARIABLES  VBScript implicitly creates a variable the first time that it encounters an unrecognized string of characters that could be a variable name.  The Option Explicit statement informs VBScript to generate an error if it encounters an undeclared variable. The Option Explicit statement should be the first line of code in a script that uses variables.  Dim varname[([subscripts])][, varname[([subscripts])]] . . .  Dim a, x(10), y(2, 5)  A variable name:  Must begin with an alphabetic character.  Cannot contain an embedded period.  Must not exceed 255 characters.  Must be unique.  Is not case-sensitive.
  • 14. USE PROCEDURES TO STRUCTURED CODE  Structured code consists of compact chunks of related code that are termed procedures.  Procedures are reusable code that can be called from anywhere in your script.  The main benefits of structured coding are as follows:  Maintenance—when related code is grouped, it is easier to maintain. When code needs to be updated or modified, you can make the changes in a single code segment rather than throughout an entire program.  Debugging—because the code is modular, you can pinpoint where an error occurs and conduct your debugging efforts in the code segment where the error occurred.  Reusability—you can call the procedures from anywhere in your script, as well as use the code segments in other programs that require the same procedures.
  • 15. SCOPE OF A VARIABLE • If a variable is declared outside of a procedure, it is visible throughout the program. • If a variable is declared inside a procedure, it is only visible inside that procedure. • The range of a variable’s visibility is called its scope. • In VBScript: – Scope is either script-level or procedure-level. – A variable is in effect within its scope. – Variable names must be unique within their scope. – Variables should always be defined with the smallest scope possible.
  • 16. WHAT IS AN OBJECT? • An object is simply a collection of functions and data grouped together. Typically, most of the object’s functionality (particularly its data structure) is hidden from the programmer, who uses the object’s interface, or model, to control the object. The object’s interface consists of a published set of functions and data. In pure object-oriented systems, data are private and therefore cannot be accessed by external object directly. • Methods: The procedures that an object exposes through its interface are called methods. Methods are typically functions and return a value.
  • 17.  Properties: The variables that are part of an object are called properties:  Reading a property’s value is called getting the property’s value.  Writing a value to a property is called setting the property’s value.  Properties can be read-only or read/write depending on the design of the object.