ASP - Computing
Download
Report
Transcript ASP - Computing
DT211/3 Internet Application
Development
Active Server Pages
& IIS Web server
Introduction
•
Purpose: to provide some practical experience of
using IIS web server and basic ASP pages
•
Active Server Pages Developed by Microsoft
•
Active Server Pages is a ‘programming model’ (as is
CGI) –
•
Similar to JSP, script is interspersed with HTML
•
Pages must have a file extension of .asp – otherwise,
server won’t know to process as an ASP page
•
Web Servers
Microsoft has two web servers that are usually used to run ASP
•IIS (Internet Information Server – Windows NT/XP Pro/2000
•PWS (Personal Web server) – up to Windows 98
•
IIS is free with Windows 2000/XP Pro, part of the Windows NT 4
option pack.
•
PWS is a scaled down version of IIS for Personal Computers.
•
ASP pages can be run on other servers, provided the server has the
ASP engine. Sun Microsystems have produced a product called
Chili!Soft ASP which enables ASP to be used on other web servers
including, Apache, I-Planet, Zeus, Red Hat Secure Server, etc,
using various operating systems including, Linux, Solaris, HP-UX,
AIX, etc.
Set up a web site in IIS
•
Open administrator tools in Control panel – and open the
Internet Server Manager
•
Shows directory structure for IIS
•
Default web site is the HTTP site. Expand the default web
site (shown overleaf) and create a virtual directory in the
Webpub directory - this will hold the documents for your
web site. (A virtual directory is just an alias for a real
directory that exists). This virtual directory will become part
of the web address to access any documents contained in it
e.g. http://localhost/Webpub/examples/blahblah.html
Set the access permissions
Set up a web site in IIS
•
Access permission = security level choices for the virtual
directory
•
Read = users can read and download files in the directory
Run Scripts = allows scripts in the directory to be run
Execute = allows applications in the directory (e.g. CGI )
to be run
Write = allows a Web page to accept user input (e.g. credit
card input
Browse = allows users to navigate from one web doc to
another via hyperlinks
http://www.webwizguide.com/asp/tutorials/installing_iis_w
inXP_pro.asp
•
•
•
•
Loading a document from IIS
•
To load a HTML doc using IIS:
First, ensure HTML doc has been placed in the virtual
directory
Then type the web address for your html doc into the
browser. This will be:
e.g http://localhost/webpub/alias/index.html
•
What ever you called the directory
To load ASP documents – do exactly as above, and
remember to access using “.asp”
e.g http://localhost/webpub/alias/somepage. asp
ASP
•
When a browser requests an ASP file, IIS passes the
request to the ASP engine (ASP.dll). The ASP engine
reads the ASP file, line by line, and executes the scripts in
the file. Finally, the ASP file is returned to the browser as
plain HTML
•
ASP pages are usually written using VBScript, but can use other
languages e.g. Microsoft’s Jscript
•
VBScript is the default language (VBScript is a scaled down version
of Visual Basic)
•
Scripting code CAN be made to run on the client OR the server.
e.g. can have an ASP page that contains Javascript validation to
run on client, and VBScript for running on server (e.g. database
access)
Uses of ASP
Can be used similar to JSP for:
•Dynamically edit, change or add any content of a Web page
•Respond to user queries or data submitted from HTML forms
•Access any data or databases and return the results to a browser
•Customize a Web page to make it more useful for individual users
•Provides security since your ASP code can not be viewed from the
browser
•Since ASP files are returned as plain HTML, they can be viewed in
any browser
Differences between VBScript
and Visual Basic
•VBScript explicitly supports one data type only , the
Variant
•VBScript is an interpreted language
•VBSCript cannot directly use the Windows API
•There are few syntactical different in the use of some
internal functions
How to start your IIS account
•The accounts are on the student webserver and can be
access to through FrontPages
\\erin.student.comp.dit.ie\dt211-3<student name>
Using <student/user name> and window password
•Your web site in IIS can be published to through Frontpage by opening
Http://www.student.comp.dit.ie/dt211-3<student name>