GET and form data

J

Jonathan Allen

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
 
S

Steven Burn

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!

| 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
|
|
|
 
J

Jonathan Allen

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
 
E

Evertjan.

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"
 
J

Jonathan Allen

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. said:
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"
 
D

Dave Anderson

Jonathan said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top