Starting with ASP: Part 2
So, now that you can recognise ASP when you meet it, what is supplied with ASP to make your
life easier? ASP (and by ASP I mean both ASP and the VBScript language) come with a number of
components supplied ready to use. In ASP 1 there were five of these components (in ASP 2 there
are some more, but these five are still the core set) and full details of the components can
be found in the ASP roadmap provided with the Microsoft web servers, however, so you don't
get bored here are the five components.
Ad Rotator |
This can be used to rotate "adverts". This should really
only be thought of as a toy and is not really suitable for a serious commercial
site, unless you put a lot of extra work in
(for example, the ASP needed to run this site makes NO use of the
Ad Rotator). The Ad Rotator will display images ("adverts") on a
specific schedule, so is in fact a useful tool if you want to present
users of your site with different images, to keep them interested. |
|
Browser Capabilities |
There is a component that will allow you to determine which browser
type is being used to view your pages; you could, based on this
information, generate pages for a specific browser type. Sound like
a nice idea? Well just hold on a few seconds as there are some problems
you should be aware of before you use this component.
All of the information that you have access to is based on the
Browscap.ini file. This is a look up where ASP goes to say, "I
have this type of browser, so what can it do". The problem is that
browser software is one of the most moving targets on the internet. In a short
space of time both Microsoft and Netscape have produced browsers up to
version 4; further, every now and again a new browser peaks above the
horizon, like Opera (and now gecko!). Relying on this component means that you can only
specifically target those browsers that it knows about.
You have
another problem, what if your ini file is different to your web hosts?
There
are also some philosophical arguments for ignoring the browser
component. As a web application designer you should want your pages to
be able to reach as wide an audience as possible. Therefore, should you
really be tailoring parts of your site so specifically that you need to
know this much about a browser?
The safest thing is to ignore this
component. If you really need to know what browser people are using
there are safer techniques which don't rely on the browser cap file!
(Look up request.servervariables for a sneak preview) |
|
Database Access |
Ah, the heart of ASP. This is the component that turns ASP from
being a good thing into ASP being a great thing. The database access
component lets you talk to any database that provides an ODBC interface,
and most do. This whole site is based around databases and so gives you
an idea of what ASP, in conjunction with databases can do. |
|
Content Linking |
The content linking component allows you to create a table of
contents and then navigate around that quickly and easily. Essentially,
you created an ordered list of your site, using the content linker you
can then let people browse to the next document on you site, return to
the previous document or jump to a specific one. This could be
especially useful if you are trying to impose some kind of book
order/feel on your site. The downside? You have to be RIGOROUS in keeping
the file related to what pages you actually have on your site -- if they
get out of step, you can find your site becomes very muddled indeed! |
|
File Access |
Lets you write to and update files on your system. NOTE
these are text files that live under the web server, this
component CAN NOT be used to access text files on the machine of
browsers. The usefulness of this component depends on the application
you are writing; you could use
it store information about visitors to your site. You can also make use
of it to automatically write static pages. So you could have ASP trigger
a script that would update a load of ordinary .htm files. Even more clever
would be to write a script that would generate new ASP scripts, but this can
get very complicated. You'll have to think on the usefulness of this for yourself.
|
You now should have a feel for what ASP looks like, and also the
components that you can make use of as standard. But do you want to write
ASP VBs (or JavaScript) by hand? Not really, so ...