Musings from the basement of a very tall building
Posted By Robin Freeman | last update 11-Jul 2010
The first Micrsoft offering for web application development was Active Server Pages (ASP). In the tall building we had spent the 90's developing visual basic forms (client tier) talking to SQL Server (storage tier) via ADO connections. ASP was of necessity a very different beast.
You see if you are going to use a browser as your client tier it is going to use the HyperText Transfer Protocol (HTTP) to talk your web application (a middle tier) via the web server that hosts it. To have any function the pages in the browser are going to collect or update information and this must be bundled up within the HTTP request at the browser end. On receipt at the web server the information must be picked out of the HTTP message and made available to the web application. This is one of the major features of ASP.
Classically HTTP carries information as Name Value pairs. You make up some meaningful name -eg- Surname; then there is an equals; then there is its value -eg- Freeman. As the meerkats say, simples.
The commonest HTTP request is called a GET and name value pairs can be placed with the page title in this type of request. They are seperated from it by a question mark. If there is more than one pair they are seperated by ampersands. The problem with this is that the title part of an HTTP request is limited to 256 characters.
To send more information you must use an HTTP POST request. Here the name value pairs (separated by ampersands if necessary) are placed at the end of the body of the HTTP request. This is effectively unlimited in length. Hypertext (the mark up used in web pages) has a FORM element for this purpose. The FORM action must be a POST, whence any named element, within the form element, will become the name part, its value becoming the value part of the pair which is put in the body of the HTTP request resulting from submission of the form. Clever that.
It is both instructive and disconcerting to watch the conversation taking place between browser and web server and HTTP sniffer applications allow this. Microsoft bought one which can be downloaded for free, google Fiddler.
The ASP page being requested on the web server will contain the Response.Write mark up. Within this a Request.QueryString["NAME"] will retrieve that value from an HTTP GET, while a Request.Form["NAME"] will retrieve that value from an HTTP POST. Thus these values can be used in the rest of the visual basic script that makes up the Response.Write and whose output is the hypertext that will be sent back to the browser.
While it was possible to have complex VB Script on the requested page to produce the output, we used it to call functions in a Visual Basic library application. This allowed the full power of VB to be applied at the cost of having to install and manage .dll's on the web server. We had several years of unsophisticated but very functional web applications from this development model. No one sensible would use this today, it was replaced by .aspnet in 2003. That is another kettle of fish I will delve into next time.