Active Server Pages deliver internet/ intranet pages to the user, or
they start a process on the server.
With server-side scripting, you can choose what kind of content to deliver
(you could convert XML to XHTML via XSL).
And starting a program on the server could for example create and delete files,
get input from a database, or organize HTML.
You can edit ASP with a normal text editor (something like Netpadd).
Basics
IIS
The Internet Information Server handles the various Microsoft implementations of the standards or the Microsoft-only methods. VBScript for example, while lacking client-side (browser) support, like by Netscape, is fully useable on the server. This means you absolutely know and control the environment.
DLL's
A DLL (Dynamic Link Library) is a compiled component. I compile them from
Visual Basic 6. They need to be classes (set to 5, Multiuse), so you should know the basics
of OOP (Object Oriented Programming). If you know subs, functions, the
difference between parameters submitted by reference and
by value, and private and public in a module
you can already start to program classes.
OOP means encapsulation, you create a black box combination
of data and functionality without the risk of exposing details to other
programs.
To register a DLL with the server, you'd enter the following in the command line:
regsvr32 ...path...\prjGuestbook.dll
VB Class
A VB class consists of public and private functions/ subs/ variables. A public variable can be accessed by the object you declare. A private variable (a private member of the class) can never be accessed directly by the instanciated object. However, you can create properties to indirectly access these. For example
Property Let specialString (byVal str as string) specialString_ = rtrim(ltrim(str)) End Property
...handles specialString just as a normal string with the exception
of trimming spaces.
"specialString_" is the private member, invisible to the program which
uses the class. On the other hand, "specialString" behaves just like
a completely normal variable, seen from the outside.
You can declare a
public variable in the head, and later on, if you decide it needs
some special error handling, or limits checking, or formatting, change
it to a property. Then you replace every "nameOf" with a "nameOf_"
(or mNameOf, or m_nameOf, or prvNameOf, etc.) in your class, and
create a property nameOf.
ASP scripting
An ASP (Active Server Page) starts with the the declaration of the scripting language, and wraps scripting parts with "<% ... %>" :
<%@ language=vbscript %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>My Page</title> </head> <body> <% if ... then %> <p>This is a sentence</p> <% else %> <p>This is another sentence</p> <% end if %> </body> </html>
You can access DLL's from an ASP. First you declare the object (split in two lines here):
<% set objGuestbook = _ Server.CreateObject("prjGuestbook.clsGuestbook")
Then access for example a method, submitting parameters the user entered in a form of a prior page:
dim entry, name, success entry = request.form( "txtEntry" ) ' could be "Hello" name = request.form( "txtName" ) ' could be "John Smith" success = objGuestbook.addEntry( entry, name ) if success then response.write "Your entry has been added!" end if %>
(You can set <% Option Explicit %>, but otherwise declaring variables is optional)
Continue with XML in ASP