GET and form data

Discussion in 'ASP General' started by Jonathan Allen, Jan 24, 2005.

  1. I have this code...

    If Request.Form("Name") = "" Then
    Response.Redirect "error.asp"
    End if

    If the browser does a GET against this page, sometimes the Response.Redirect
    doesn't happen. It is as if there is form data being sent on a GET.

    Has anyone seen this before?

    Jonathan
     
    Jonathan Allen, Jan 24, 2005
    #1
    1. Advertising

  2. Jonathan Allen

    Steven Burn Guest

    You need to use Request.Querystring for GET requests...... and Request.Form for POST requests.

    If Request.Form("Name") = "" AND Request.Querystring("Name") = "" Then
    Response.Redirect "error.asp"
    End if

    --

    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    "Jonathan Allen" <> wrote in message news:...
    | I have this code...
    |
    | If Request.Form("Name") = "" Then
    | Response.Redirect "error.asp"
    | End if
    |
    | If the browser does a GET against this page, sometimes the Response.Redirect
    | doesn't happen. It is as if there is form data being sent on a GET.
    |
    | Has anyone seen this before?
    |
    | Jonathan
    |
    |
    |
     
    Steven Burn, Jan 24, 2005
    #2
    1. Advertising

  3. Yes, we all know what SHOULD be happening. But in reality, something strange
    is going on.

    Is there any combination of browser, OS, phase of the moon, that would cause
    a GET request to have form data? Or at least make IIS think there is form
    data?

    Jonathan


    "Steven Burn" <> wrote in message
    news:...
    > You need to use Request.Querystring for GET requests...... and
    > Request.Form for POST requests.
    >
    > If Request.Form("Name") = "" AND Request.Querystring("Name") = "" Then
    > Response.Redirect "error.asp"
    > End if
    >
    > --
    >
    > Regards
    >
    > Steven Burn
    > Ur I.T. Mate Group
    > www.it-mate.co.uk
    >
    > Keeping it FREE!
    >
    > "Jonathan Allen" <> wrote in message
    > news:...
    > | I have this code...
    > |
    > | If Request.Form("Name") = "" Then
    > | Response.Redirect "error.asp"
    > | End if
    > |
    > | If the browser does a GET against this page, sometimes the
    > Response.Redirect
    > | doesn't happen. It is as if there is form data being sent on a GET.
    > |
    > | Has anyone seen this before?
    > |
    > | Jonathan
    > |
    > |
    > |
    >
     
    Jonathan Allen, Jan 24, 2005
    #3
  4. Jonathan Allen

    Evertjan. Guest

    Jonathan Allen wrote on 24 jan 2005 in
    microsoft.public.inetserver.asp.general:
    > | If Request.Form("Name") = "" Then
    > | Response.Redirect "error.asp"
    > | End if


    > Yes, we all know what SHOULD be happening. But in reality, something
    > strange is going on.
    >
    > Is there any combination of browser, OS, phase of the moon, that would
    > cause a GET request to have form data? Or at least make IIS think
    > there is form data?
    >


    I think:

    Response redirect gives a header request to the browser to redirect.
    so the GET is browser dependent.

    Could you try a GET of:

    application("noformname")="no"
    If Request.Form("Name") = "" Then
    application("noformname")="yes"
    End if

    [and thest for that application variable in another asp-file]

    and seperate a GET of just:

    Response.Redirect "error.asp"


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Jan 24, 2005
    #4
  5. > Response redirect gives a header request to the browser to redirect.
    > so the GET is browser dependent.
    >


    True, but it looks like my users are using Win95/98 and IE. Also, a
    Response.Redirect halts the execution of the script, so there shouldn't be
    any way to continue even if the browser gets confused.

    Jonathan



    "Evertjan." <> wrote in message
    news:Xns95E8DDD446781eejj99@194.109.133.29...
    > Jonathan Allen wrote on 24 jan 2005 in
    > microsoft.public.inetserver.asp.general:
    >> | If Request.Form("Name") = "" Then
    >> | Response.Redirect "error.asp"
    >> | End if

    >
    >> Yes, we all know what SHOULD be happening. But in reality, something
    >> strange is going on.
    >>
    >> Is there any combination of browser, OS, phase of the moon, that would
    >> cause a GET request to have form data? Or at least make IIS think
    >> there is form data?
    >>

    >
    > I think:
    >
    > Response redirect gives a header request to the browser to redirect.
    > so the GET is browser dependent.
    >
    > Could you try a GET of:
    >
    > application("noformname")="no"
    > If Request.Form("Name") = "" Then
    > application("noformname")="yes"
    > End if
    >
    > [and thest for that application variable in another asp-file]
    >
    > and seperate a GET of just:
    >
    > Response.Redirect "error.asp"
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
     
    Jonathan Allen, Jan 24, 2005
    #5
  6. Jonathan Allen wrote:
    > If Request.Form("Name") = "" Then
    > Response.Redirect "error.asp"
    > End if
    >
    > If the browser does a GET against this page, sometimes the
    > Response.Redirect doesn't happen. It is as if there is form data
    > being sent on a GET.


    Since Request.Form("Name") is an OBJECT with properties other than string
    values, I am never surprised to see "unexpected" behavior when comparing it
    to a string. Alternatives to consider:

    • If Request.Form("Name").Count = 0 Then...
    • If Request.Form("Name").Item = "" Then...
    • If Request.Form("Name").Item = "" And
    Request.QueryString("Name").Item = "" Then...


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
     
    Dave Anderson, Jan 24, 2005
    #6
    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. Michael Mitchell via DotNetMonster.com

    Collecting Data on one form and outputing it on another form

    Michael Mitchell via DotNetMonster.com, Jan 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    471
    Michael Mitchell via DotNetMonster.com
    Jan 23, 2005
  2. Li Zhang
    Replies:
    4
    Views:
    6,142
    softip
    Feb 27, 2009
  3. Mr. SweatyFinger

    get all the form fields in a form

    Mr. SweatyFinger, Jan 26, 2007, in forum: ASP .Net
    Replies:
    20
    Views:
    898
    Alexey Smirnov
    Jan 31, 2007
  4. Kevin DeValck
    Replies:
    1
    Views:
    779
    7stud --
    May 17, 2011
  5. rob c
    Replies:
    4
    Views:
    367
    McKirahan
    Dec 30, 2005
Loading...

Share This Page