with one major difference. The processing of the scripting language is performed on the web server, not the client browser. So how does server-side scripting
actually work? Up to now, we have learned that web pages have a file extension of either .htm or .html. Any basic web server can process web
requests for these types of files and return HTML code back to the user agent (browser). However, when a browser makes a request for a file that
ends in .asp, the web server needs to have a way to process this file type. In the case of Microsoft's Internet Information Server (IIS), the
web server knows to use the ASP.DLL file loaded into memory to interpret the ASP code into HTML. Once interpreted, the results are
sent back to the browser as plain HTML.
When a web browser makes a request for an ASP page, the web server must take additional steps
to process the request prior to sending the HTML back to the browser. Here is an example of the
steps that are taken:
- The client makes a request for an ASP page to the web server, such as http://domain.com/page.asp
- The IIS web server receives the request.
- Since the request was for a file with a .asp extension, it sends the file to ASP.dll for processing.
- ASP.dll reads the file and processes the file line by line and executes all of the code
within the <% and %> tags.
- Standard HTML is produced by ASP.dll
- The web server sends the plain HTML content back to the browser.
- The client browser displays the results in the browser window.
In the following example, the Response.Write command is used to write output to a browser. The following example sends the text
"Hello World!" back to the browser. The following lines of code should be placed in a text file save with a .asp extension. The file can
be uploaded to a Microsoft IIS web server with ASP installed and enabled.
Recommended Books & Training Resources