Go Back   Computer Forums > General Computing > Hardware
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 08-30-2005, 10:26 PM   #1
Beta Member
Join Date: Aug 2005
Posts: 3
Unhappy Need your help

explain the process that occurs between a client and a server when requesting a Web page. Why should network architects concern themselves with the OSI Model and data frames?

pr8thr is offline   Reply With Quote
Old 08-30-2005, 11:12 PM   #2
Golden Master
jac006's Avatar
Join Date: Oct 2004
Posts: 5,810
Send a message via AIM to jac006
Default Re: Need your help

The Request.ServerVariables collection contains a number of HTTP Headers and environment variables. It is important to understand that these are two entirely different things. The HTTP Headers are additional information the browser sends to the web server when requesting an web page, while the environment variables contain site-wide information stored by the web server. In this article we will examine first the HTTP headers and then the environment variables.

HTTP Headers:
Whenever you visit a web page, a complicated dialog occurs between the client (your browser) and the server (the web server that contains the web page you are requesting). This dialog looks something like this:

* Client: Connect to Server
* Server: Accept connection
* Client: Send HTTP Headers, finishing with a request for the web page
* Server: Log these HTTP headers, retrieve the web page and send it to the client
* Client: disconnect from the server and render the HTML received

In fact, you can actively participate in this dialog if you have access to a UNIX machine. Logon, and enter the following command at the prompt:

telnet www.4guysfromrolla.com 80

This will connect to the 4GuysFromRolla.com web server on port 80 (the default HTTP port). Once you connect to the server, the server waits for you to make your request. Begin by entering in the HTTP headers you want to send. There are several common HTTP headers, the two most common ones being User-Agent and Referer. User-Agent contains information about the browser while Referer, if it exists, indicates the URL that contained the link that the user clicked on to reach the given page. To send the User-Agent and Referer headers, we would type in:

User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Referer: http://www.go.com

Next, we would need to specify the web page we were interested in retrieving. If we want to obtain the default document, we can do:


Now, hit enter twice, and you'll see the HTML for http://www.4GuysFromRolla.com/index.shtml! Neat, eh? This is the process that your browser goes through each time you visit a web page! Hopefully this gives you a bit more appreciation for what a web browser needs to do to view a web page! Not only does this dialog need to occur, but a complex parsing algorithm needs to be used to convert the HTML into those pretty animated GIFs and Frames we all love...

As I mentioned, the two most common HTTP Headers are Referer and User-Agent. An HTTP header can be obtained from the Request.ServerVariables collection using the following syntax:

Request.ServerVariables("HTTP_HTTP Header Name")

So, if you want to display the Referer HTTP Header on an ASP page, you can do:


For a good article on a practical use of the Referer HTTP Header, check out Joao Vieira's Two Ways to Protect your ASP Pages. (Note: Cookies are also pass from the client to the server through HTTP headers!)

Environment Variables
Along with the HTTP Headers, the Request.ServerVariables collection contains a number of site-wide environment variables. These environment variables contain information like the web server software being used (Server_Software), what HTTP port is being used (Server_Port), the URL of the currently processing ASP page (Script_Name), the physical path of the root web application (Appl_Physical_Path), and others. To reference an environment variable from the Request.ServerVariables collection, use the following syntax:

Request.ServerVariables("Environment Variable Name")

So, to list the IP Address of the client requesting a web page, you can use:


In fact, you can list all of the environment variables and HTTP headers using the following code:

<B>Server Varriable</B>

<% For Each name In Request.ServerVariables %>
<%= name %>
<%= Request.ServerVariables(name) %>
<% Next %>

As for the second question, I'm not exactly positive. Maybe David has some answers... he's experienced more than I have in these matters... pm him maybe or maybe he'll respond here. Hope this helps.
Macbook Pro and Logitech z5500s. All you really need.
jac006 is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 04:21 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0