Active Server Pages (ASP)

Download as pps, pdf, or txt
Download as pps, pdf, or txt
You are on page 1of 12

Active Server Pages (ASP)

ASP is a powerful server-based technology


from Microsoft, designed to create dynamic
and interactive HTML pages for your
WWW.
Advantages of ASP

– ASP is very simple to learn, much easier


than Perl and C.
– Built-in database interfacing elements
– Choice of scripting languages JavaScript,
Vbscript, Jscript
– ASP components give several benefits to
ASP programmers: speed, security,
modularity and extensibility. Since ASP
components are compiled, they will execute
much faster than standard, interpreted ASP
codes
Execution of an ASP file:
– A browser sends request for .asp file to web
server.
– The web server searches for the .asp file asked
for either on the disk or in the memory.
– The web server forwards the request to a file
named asp.dll, which is called as ASP engine,
for execution.
– The ASP engine executes the required asp file
from top to bottom. The commands enclosed in
<% %> are executed. At this stage there may
be a connection made to a database or another
asp file may be invoked.
– The result of this process is a standard .html file.
– The, html file sent back to web browser.
– The browser interprets .html file and displays
result.
ASP Object Model:
• The Active Server Object Model consists
of Six intrinsic objects. These objects do
not need to be created before they are
used.
1. Request object - Data sent from client to
server
2. Response object - Data sent from server
to client
3. Application object - Application wide data
4. Session object - User specific data
5. Server object - Extending IIS with custom
components
6. ASP Error Object
Installation Procedure:
– Install IIS from control panel
– Control Panel – Add /Remove programs –
Add / Remove Windows components – IIS
– Make the directory web sharing.
– Go to properties. Give all permissions.
‘Execute’ enable.
– Go to Administrator Tools.
– Administrator Tools – Internet Information
Services – Default website – Go to default
web site. – Keep proper menu name. –
Remove invalid names (like default.html,
index.html etc.), if any.
Ex -- Hello World.asp
<html>
<head><title>Hello!World</title>
<head>
<body>
<%
Dim var1
Var1 = "Hello World"
Response. Write var1
%>
</body>
</html>
• How do you specify scripting language?
You can use Vbscript, JavaScript or
Jscript in ASP. You can use more than
one scripting languages in one program.
There are many ways of specifying the
default scripting language:
1. Make a default setting in IIS for
Default Web Site.
• Control panel – Administrative Tools – Internet
Service Manager – Default web site – properties –
Home directory – Configuration – App Options –
Default ASP language
2. Specify primary scripting language for
a particular page.
<%@ LANGUAGE = JSCRIPT %>
<Html> … </Html>
23. You can change the script using
<script> tag within a page.
<Html>
<Body>
<Script LANGUAGE = “JavaScript”>
</Script>
</Body>
</Html>
Example: DateTime.asp
<html>
<head><title>Date & Time</title></head>
<body>
<% Response.write "Today is " & Now()%>
<%Response.write "Today's date is" & date()
%>
<%Response.write "Today's Time is" &
time()%>
</body>
</html>
<HTML>
<HEAD><TITLE>The Polite Web
Server</TITLE></HEAD>
<BODY BGCOLOR="wheat">
<H1>Welcome</H1>
<FONT SIZE="3">
<B>This is the Polite Web Server, at <% = Time %> on
<% = Date %></B></FONT>
<% If Hour(Now) < 8 then %>
Good Morning!
<% End if %>
</BODY>
</HTML>