| << F.3.0- RequestSniffer.asp | AppendixF | F.4.0- Text Fields >> |
Using RequestSniffer
To use this tool you copy or create the RequestSniffer.asp page in an appropriate folder onyour site (probably the root folder). Then create any form that you want totest. This form can send data by either the POSTor GET method, and with any number or combinationof field types. Set the form's ACTION=RequestSniffer.asp.Save and then open the form in your browser. When you click submit you'll getthe RequestSniffer, which shows you what names and values are being returnedfrom the form. With that knowledge you can then write your real response page,and change the ACTION of your form fromRequestSniffer to the response page.
For a demonstration of the RequestSniffer, let's look atsome differences between the GET and POST methods. Remember that we are using theRequestSniffer in every case, so there is no other response page. Also notethat even though the code changes slightly in these three demo pages theappearance on the screen is the same, so I won't show the form screen shotagain and again.
Sample Sniffer 01 – Using GET
We'll start with a form that uses GETto send one data value – this is the page Sniffer01Form.htm:
<HTML>
<HEAD>
<META NAME="GENERATOR"Content="Microsoft Visual Studio 6.0">
<TITLE>Sniffer_01_Form</TITLE>
</HEAD>
<BODY>
<H3>Sniffer 01 Form Using Get</H3>
<FORM ACTION="RequestSniffer.asp"METHOD=GET NAME="Form1">
<INPUT NAME="NameFirst" VALUE="TypeYour Name Here"><BR>
<INPUT TYPE="SUBMIT" VALUE="SubmitQuery">
</FORM>
</BODY>
</HTML>
| When you run this page in a browser, enter a name and click Submit Query , you should see something like the following. Note that when using GET the data from the form is held in the QueryString collection of the Request object. Also note that the data is appended to the URL, and is thus visible on the address line:
|
|
Sample Sniffer 02 – Using POST
We can also send the same information using the POST method – this is the page Sniffer02:
...
<TITLE>Sniffer_02_Form</TITLE>
</HEAD>
<BODY>
<H3>Sniffer 02 Form Using POST</H3>
<FORM ACTION="RequestSniffer.asp"METHOD=POST NAME="Form1">
<INPUT NAME="NameFirst" VALUE="TypeYour Name Here"><BR>
<INPUT TYPE="SUBMIT" VALUE="SubmitQuery">
</FORM>
</BODY>
...
| This time, the data from the form is held in the Form collection of the Request Object. With POST the data is not visible with the URL, and is thus protected from the casual observer:
|
|
Sample Sniffer 03 – Using Default
Finally, try running the last .htmwith the METHOD attribute omitted: the resultwill be identical to the first screenshot, equivalent to using a GET.
| << F.3.0- RequestSniffer.asp | AppendixF | F.4.0- Text Fields >> |

RSS



