Computers & ProgrammingASPBackend Development

Server Side Scripting with ASP

If you have already learned JavaScript, then you have an understanding of the concept of client-side scripting. Server-side scripting is similar, but 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?

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.

ASP Processing

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:

  1. The client makes a request for an ASP page to the web server, such as http://domain.com/page.asp
  2. The IIS web server receives the request.
  3. Since the request was for a file with a .asp extension, it sends the file to ASP.dll for processing.
  4. ASP.dll reads the file and processes the file line by line and executes all of the code
    within the <% and %> tags.
  5. Standard HTML is produced by ASP.dll
  6. The web server sends the plain HTML content back to the browser.
  7. The client browser displays the results in the browser window.

First Example

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.

<!DOCTYPE html>
<html>
<head>
    <title>Hello World!</title>
</head>
<body>
<%
Response.Write("Hello World!")
%>
</body>
</html>

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top