Request("controlname") can use for both GET and POST protocol??

Discussion in 'ASP General' started by Matt, Jan 11, 2004.

  1. Matt

    Matt Guest

    If we use GET protocol, we can use either Request("controlname") or
    Request.QueryString("controlname") to get the data entered by the user. But
    if we use POST protocol, we MUST use Request("controlname"), and
    Request.QueryString("controlname") won't work. I think
    Request("controlname") means Request.Form("controlname"), which is used for
    POST protocol. But seems like it works for GET protocol too.

    Here's the code I tested.

    <%
    If (Request("submitgetbtn") = "GET Submit") Then
    Response.Write(Request("fname"))
    End If

    If (Request.QueryString("submitpostbtn") = "POST Submit") Then
    Response.Write(Request("lname"))
    End If

    %>
    <form action="getposttest.asp" method="get">
    <input type="text" name="fname">
    <input type="submit" name="submitgetbtn" value="GET Submit">
    </form>

    <form action="getposttest.asp" method="post">
    <input type="text" name="lname">
    <input type="submit" name="submitpostbtn" value="POST Submit">
    </form>

    Please advise! Thanks!
     
    Matt, Jan 11, 2004
    #1
    1. Advertising

  2. Matt

    Ray at Guest

    Do NOT ever use Request("controlname").
    http://www.aspfaq.com/show.asp?id=2111

    Ray at home

    "Matt" <> wrote in message
    news:Oi$...
    > If we use GET protocol, we can use either Request("controlname") or
    > Request.QueryString("controlname") to get the data entered by the user.

    But
    > if we use POST protocol, we MUST use Request("controlname"), and
    > Request.QueryString("controlname") won't work. I think
    > Request("controlname") means Request.Form("controlname"), which is used

    for
    > POST protocol. But seems like it works for GET protocol too.
    >
    > Here's the code I tested.
    >
    > <%
    > If (Request("submitgetbtn") = "GET Submit") Then
    > Response.Write(Request("fname"))
    > End If
    >
    > If (Request.QueryString("submitpostbtn") = "POST Submit") Then
    > Response.Write(Request("lname"))
    > End If
    >
    > %>
    > <form action="getposttest.asp" method="get">
    > <input type="text" name="fname">
    > <input type="submit" name="submitgetbtn" value="GET Submit">
    > </form>
    >
    > <form action="getposttest.asp" method="post">
    > <input type="text" name="lname">
    > <input type="submit" name="submitpostbtn" value="POST Submit">
    > </form>
    >
    > Please advise! Thanks!
    >
    >
     
    Ray at, Jan 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christian H
    Replies:
    1
    Views:
    908
    Natty Gur
    Jul 29, 2003
  2. Jim Andersen

    2.0, Namespaces, Me.<controlname>

    Jim Andersen, Mar 6, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    390
    Jim Andersen
    Mar 7, 2006
  3. Joe
    Replies:
    1
    Views:
    453
    =?Utf-8?B?RFdT?=
    Mar 9, 2006
  4. Terry
    Replies:
    0
    Views:
    234
    Terry
    Sep 11, 2008
  5. Matt
    Replies:
    1
    Views:
    168
    Brynn
    Jan 18, 2004
Loading...

Share This Page