frmhello2.asp

Page source

<HTML> <HEAD> <TITLE>interaction with client information -- response</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> Hello Larry, my friend. I see you are at 127.0.0.1, and you are using the Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4Web client. </BODY> </HTML>

Script listing

<HTML> <HEAD> <TITLE>interaction with client information -- response</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <% dim strName 'name typed on the form dim strIPAdd 'client’s IP address dim strBrowser 'client browser name strName = request.form ("txtName") strIPAdd = request.servervariables ("remote_addr") strBrowser = request.servervariables ("http_user_agent") response.write ("Hello " & strName & ", my friend. I see you are at " & strIPAdd & ", and you are using the " & strBrowser & "Web client.") %> </BODY> </HTML>

Explanation

This script is called by frmhello2.htm. It uses the form method of the request object to read the name the user entered in the form.

When the user submits the form, certain header information is automatically sent to the server. This automatically included information is retrieved using the servervariables method of the request object.

In this example, we are retrieving the client IP address and browser identification.

The name, IP address and browser characteristics are included in the output page using the write method of the response object.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.