| ASP
Definition
ASP (Active Server Pages) is a Microsoft-developed
HTML-embedded, server-side scripting languages
used to create web pages.
ASP is a "framework" development environment,
inside which you can invoke ASP properties
and methods using the ASP-enabled language
of your choice. Currently the 2 primary
languages are Jscript and VBScript, both
by Microsoft. ASP is designed to run on
Microsoft's Internet Information Services
web server, though it can run in other environments
as well.
What It Really Is
ASP is often the "non-developer's choice".
It was designed for, and is highly geared
towards those who have never done scripting
before. It allows the complex, while appearing
relatively simple. There are no semi-colons
to finish lines, no curly braces to tell
the computer you want to "do stuff". It
is kept simple, and yet is incredibly powerful,
especially inside a Microsoft environment.
ASP's realm really is web-based development.
Whether you require a simple guestbook,
or a complex E-Commerce application, ASP
is more than capable of handling it. With
standard functions such as connecting to
databases, retrieving user and server information
and extensions which allow Uploading, Image
Mapping, etc, it is easy to see why ASP
is one of the top web scripting languages
today.
Advantages
+ Ease of learning for non-developers
+ Integration with existing Microsoft
Products
+ Ease of extension via COM objects
+ Comes free with most Windows operating
systems
+ Developed by Microsoft
Disadvantages
+ Strongest in a Windows environment,
weaker on Unix or other platforms
+ Developed by Microsoft
Examples
The ASP documentation is available both
with IIS, as well as at the MSDN (msdn.microsoft.com).
Simple
If/Else
<%
a=0
if a=0
then response.write "a is 0"
else response.write "a is not 0"
end if
%> |
|
Comparison
Operators
a = b
Checks if the value held in $a is
the same as that held in $b
Not a = b
Checks if the value held in $a is
not equal to that held in $b
A < b
Returns true if the value held in
$a is LESS THAN that held in $b
A > b
Returns true if the value held in
$a is GREATER THAN that held in |
Write out "1, 2, 3, 4, 5, 6, 7, 8,
9, 10
<% For I=0 to 10
If I < 10 then
Response.write I & ", "
Else Response.write I
End if
Next
%> |
Microsoft Access Database Connection
<%
DBPath =Server.Mappath("database.mdb")
Set Con = Server.CreateObject( "ADODB.Connection"
)
Con.Open "DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=" & DBPath
%> |
SQL Server Database Connection
<%
Set objConn = Server.CreateObject("ADODB.Connection")
ObjConn.Open "Provider=SQLOLEDB; SERVER=YOURSERVER;
Database=YOURDATABASE; uid=username;
password=password"
%> |
SQL Server Database Connection
<%
Set objConn = Server.CreateObject("ADODB.Connection")
ObjConn.Open "Provider=SQLOLEDB; SERVER=YOURSERVER;
Database=YOURDATABASE; uid=username;
password=password"
%> |
Similar Technologies
Just about every web-based scripting language
is very similar, because they all fulfill
the same purpose, however here are the most
common:
+ PHP: PHP is an Open Source C-based
scripting language. It is very powerful,
fast, and has an amazing user community.
+ CFM: Cold Fusion is a Macromedia technology
which makes development simple by relying
on HTML-like tags to program your sites.
+ JSP: Java Server Pages employ the power
of Java, for the web. They tend to be
slightly slower than other languages,
but with the power of Java behind them
end up being extremely robust.
ASP Documentation
ASP Documentation is available with every
full install of Microsoft Internet Information
Server. It is viewable through http://localhost/iishelp
if it is installed. If not, check your installation
options. Though Microsoft Personal Web Server
does allow ASP, and does provide ASP documentation
it is both sparse and inaccurate. Also,
PWS is definitely not the best Webserver
you could pick to use, though if it is your
only one it is better then nothing.
|