
Active Server Pages (ASP) and DatabasesBy: Drs Marcel Feenstra, MALD, MBA (AfterImage Internet Marketing)Active Server Pages (ASP) is a "scripting environment" that has been part of Microsoft's Internet Information Server since version 3. ASP-driven sites can use a variety of built-in and external components, including one for accessing databases. As a result, it is relatively easy to build an advanced, interactive website using ASP. Server-Side ScriptingASP scripts are executed by the web server, not the web browser. Therefore, it is possible (at least in principle) to build a website with ASP that can be viewed by a wide variety of web browsers: ranging from a "text-only" browser such as Lynx to the latest version of Netscape Communicator or Microsoft Internet Explorer.Obviously, these browsers do not offer the exact same facilities; using ASP, however, the web server can "recognize" which browser is being used by each visitor, so that it can use the facilities supported by that specific browser. As a result, an ASP-driven website does not have to focus on the greatest common denominator. Instead, different content can be shown for each type of browser (e.g.: with or without pictures; with or without JavaScript; and so on). ASP-files use the file extension ".ASP" instead of ".HTM". The web server therefore "knows" that it should not just send the files to the web browser; instead, they should be "executed" on the server, and the results should be sent to the browser. ASP-files can contain a mixture of ASP scripts and "normal" HTML-code. The ASP scripts are contained within special "delimiters": <% and %>. ASP is an open environment; scripts can be written in many different languages. JavaScript and VBScript are available in a standard installation, but other languages like Perl can be used if you install the appropriate "engine". Programming in VBScriptHere's some code in VBScript:<% For A = 1 To 5 %> As mentioned before, script and HTML-code can be mixed. The meaning of the code fragment "<%=A%>" is, that the then-current value of variable A is written to the browser. It is interesting to see exactly what is sent to the browser: <FONT SIZE="1">Hello world!</FONT> In other words: the end user only sees the resulting HTML-code; the "underlying" ASP-code remains hidden! This means that ASP already provides some amount of protection. Database and other componentsA key characteristic of the ASP environment is that it can use components.They can be built-in components, such as the component that is used to recognize a visitor's web browser, or the component that provides database access; but external ("3rd party") components can be used as well, as long as they follow Microsoft's COM specifications. Components can be created using a variety of programming languages, from MicroFocus COBOL to Visual Basic and Delphi. For most website developers, the most important component is the one providing database access. Using this component, all kinds of databases can be accessed (e.g., MS SQL Server, MS Access, Paradox or dBase). The ASP scripts can read data from the database, write data to the database, and even change its structure, using Structured Query Language (SQL) statements. This is actually a bit more complicated than it sounds, for an Internet application (almost by definition) has to be able to support multiple users at the same time. This leads to specialized issues such as "locking" and "transactions". (Not to mention performance issues!) In a short article like this, one cannot fully cover all of the facilities offered by ASP; fortunately, however, there are several sources on the Internet that provide additional information; e.g.: For more information, please feel free to contact us.
|
AfterImage Internet Marketing
Internet Consultancy |