Groups | Blog | Home
all groups > inetserver asp general > january 2005 >

inetserver asp general : Check Existence of QueryString


Mark Schupp
1/31/2005 9:05:39 AM
Not to pick nits, and probably not a concern to the original poster but

test.asp?newdata=xxx
test.asp?morenewdata=yyy

would both get hits for "newdata="

If that is a possibility then a more complex condition must be checked.
Something like the following (not tested, may need tweaking)

lcase(left(request.querystring, len("newdata=")))="newdata=" Or _
instr(request.querystring,"&newdata=")>0

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


[quoted text, click to view]

McKirahan
1/31/2005 9:40:56 AM
[quoted text, click to view]

What's the difference?

If Request.QueryString() <> "" Then {whatever}

Chris Hohmann
1/31/2005 10:48:04 AM
[quoted text, click to view]

Response.Write IsEmpty(Request.Querystring("val"))

Keith
1/31/2005 3:35:25 PM
What is the easiest way to check if a particular QueryString exists?

I want to know if the QueryString was ever passed rather than whether it
contains a value or not.

Evertjan.
1/31/2005 3:49:55 PM
Keith wrote on 31 jan 2005 in microsoft.public.inetserver.asp.general:
[quoted text, click to view]


http://localhost/test.asp?qwerty=
and
http://localhost/test.asp?a=1&qwerty=zzz

using test.asp:

<%
response.write instr(request.querystring,"qwerty=")>0
%>

will both write:

True

=========================================

http://localhost/test.asp?qwertXy=7

will write:

False


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
Dave Anderson
2/5/2005 2:38:11 PM
[quoted text, click to view]

More to the point, Request.QueryString("val") is an *object*, and one with a
property already suitable for this task:

Request.Querystring("val").Count

The .Count property will return 0 if the parameter is not present and 1 (or
more) if present.



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

AddThis Social Bookmark Button