home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / src / ASP / getpost.asp < prev    next >
Encoding:
Text File  |  2001-06-08  |  2.3 KB  |  52 lines

  1. <%
  2. '*******************************************************
  3. '*     ASP 101 Sample Code - http://www.asp101.com     *
  4. '*                                                     *
  5. '*   This code is made available as a service to our   *
  6. '*      visitors and is provided strictly for the      *
  7. '*               purpose of illustration.              *
  8. '*                                                     *
  9. '* Please direct all inquiries to webmaster@asp101.com *
  10. '*******************************************************
  11. %>
  12.  
  13. <!-- Notice the only difference in the two forms is the METHOD attribute -->
  14. <FORM ACTION="getpost.asp" METHOD="get">
  15.     <INPUT TYPE="text" NAME="Text" VALUE="Hello World"></INPUT>
  16.     <INPUT TYPE="submit" VALUE="Use Get"></INPUT>
  17. </FORM>
  18. <BR>
  19. <FORM ACTION="getpost.asp" METHOD="post">
  20.     <INPUT TYPE="text" NAME="Text" VALUE="Hello World"></INPUT>
  21.     <INPUT TYPE="submit" VALUE="Use Post"></INPUT>
  22. </FORM>
  23.  
  24. <BR>
  25. <BR>
  26.  
  27. <% If Request.QueryString("Text") <> "" Then %>
  28.     The text in the box was "<B><%= Request.QueryString("Text") %></B>"<BR>
  29.     It looks like you used "<B>get</B>" to send it.<BR>
  30.     <BR>
  31.     Using "get" to pass information sends the information appended to the
  32.     request for the processing page.  It tends to be simpler and you    can
  33.     troubleshoot any problems simply by looking at the address bar in your
  34.     browser since all values passed are displayed there.  This is also the
  35.     primary weakness of this method.  The data being passed is visible and
  36.     is limited in size to the maximum length of a request string.
  37. <% End If %>
  38.  
  39. <% If Request.Form("Text") <> "" Then %>
  40.     The text in the box was "<B><%= Request.Form("Text") %></B>"<BR>
  41.     It looks like you used "<B>post</B>" to send it.<BR>
  42.     <BR>
  43.     Using "post" to pass information sends the information embedded in a
  44.     header during the request for the processing page.  It's main advantage
  45.     is that you can send larger amounts of information.  It also doesn't
  46.     make that information visible in the address bar of the browser which
  47.     is nice if you are using the "hidden" input type.  The value of this
  48.     type is still readily available to the user by using view source, but
  49.     the average user won't see it or be confused by any information you may
  50.     need to pass from your form for processing.
  51. <% End If %>
  52.