Did you find this useful?
Socialize it today.

Server Side Scripting with ASP

Wednesday, August 08, 2012

tags ASP

If you have already learned JavaScript, then you have an understanding on 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? 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.


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>
     <title>Hello World!</title>
Response.Write("Hello World!")

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.

Recommended Books & Training Resources

ASP In A Nutshell Beginning ASP Databases Sams Teach Yourself Active Server Pages 3.0 in 21 Days