473,322 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Check Querystring

Hi Guys
Here is what I am doing ... Have a page default.asp which looks at the
url and checks for querystring's. if there are none passed goes to a
function. if there are particular querystrings passed goes to the
respective function.
Now there can be only 2 valid querystrings that can be passed and only
one at a time. How to do i check for querystrings that dont exist and
send them to error page?

for example I have QS(querystring) ID and State. only one can exist at
a time or none. if I pass QS country along with one of those two, it
still goes to that function. Can I look for querystring that shouldnt
be valid in my case and redirect them to error page?

Here is my code! thanks

***********************

If (Request.QueryString("ID") <> "") Then
If (Request.QueryString("State") <> "") Then
Response.Redirect("error.asp")
Else
rs__MMColParam = Request.QueryString("ID")
display()
End if
Else if (Request.QueryString("State") <> "") Then
statereq = Request.QueryString("State") 'statereq --- State requested
select case statereq
case "AL"
alreq()
case "AZ"
azreq()
case "CO"
coreq()
case "FL"
flreq()
case "IN"
inreq()
case "MI"
mireq()
case "OH"
ohreq()
case "OR"
orreq()
case "VA"
vareq()
case "WA"
wareq()
case "APTS"
aptsreq()
case else
Response.Redirect "error.asp"
end select
Else
normal()
End If
End If

Jul 22 '05 #1
4 2621
"Deepster" <de********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Now there can be only 2 valid querystrings that can be passed and only
one at a time. How to do i check for querystrings that dont exist and
send them to error page?


For Each eArg in Request.QueryString
Select Case eArg
Case "ID"
' We were given an ID - deal with it
' Check for QS( "State" ) as well, or simply give ID priority

Case "State"
' We were given a State - deal with that

Case Else
' Don't know /what/ this is ...
' Off the error page we go ...

End Select
Next

HTH,
Phill W.
Jul 22 '05 #2
On 27 Jan 2005 14:26:06 -0800, "Deepster" <de********@yahoo.com>
wrote:
Here is my code! thanks

***********************

If (Request.QueryString("ID") <> "") Then
If (Request.QueryString("State") <> "") Then
Response.Redirect("error.asp")
Else
rs__MMColParam = Request.QueryString("ID")
display()
End if
Else if (Request.QueryString("State") <> "") Then
statereq = Request.QueryString("State") 'statereq --- State requested
select case statereq
case "AL"
alreq()
case "AZ"
azreq()
case "CO"
coreq()
case "FL"
flreq()
case "IN"
inreq()
case "MI"
mireq()
case "OH"
ohreq()
case "OR"
orreq()
case "VA"
vareq()
case "WA"
wareq()
case "APTS"
aptsreq()
case else
Response.Redirect "error.asp"
end select
Else
normal()
End If
End If

What do the XXreq() functions do? Smells like there's lots of code
replicated in them and you'd be better of with a single function and
an argument?

--
Iain Norman | http://www.eliteforum.org
Jul 22 '05 #3
Thanks for your help guys!

As for describing how the site works, well user comes to my page gets
the default page. If the user wants more information on state basis the
default page loads with the querystring "State" and then I do select
case to direct them to each functions. Once inside the state page they
can click on individual results, this is where the querystring "id"
comes into play and is passed on to the default page.
Phil, I will try the code out and let you know how it goes.

Thanks

Jul 22 '05 #4
Gazing into my crystal ball I observed "Deepster" <de********@yahoo.com>
writing in news:11*********************@z14g2000cwz.googlegro ups.com:
Thanks for your help guys!

As for describing how the site works, well user comes to my page gets
the default page. If the user wants more information on state basis the
default page loads with the querystring "State" and then I do select
case to direct them to each functions. Once inside the state page they
can click on individual results, this is where the querystring "id"
comes into play and is passed on to the default page.
Phil, I will try the code out and let you know how it goes.

Thanks


Totally OT for this group, but if you can rename "id" to something else,
you're not going to have problems with Google spidering it. Google won't
spider URIs with "id" in the string.

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Deepiceman | last post by:
Hi all, I am new to asp so bear with me. I want to write a page which will load a default page for me with some links and all. lets say someone clicks on the link, which not only points to the...
5
by: Keith | last post by:
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.
1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
4
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to...
12
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
2
by: Imran Aziz | last post by:
Hello All, I have ASP.net , C# pages checking for query string variables, the old ASP has a count property that one could check for each key/value pair to determine if it is available in the query...
2
by: shapper | last post by:
Hello, How can I check if a parameter, for example "name", is available in a QueryString? I need to create a default value if the parameter is not available. Thanks, Miguel
4
by: JBiggsCC | last post by:
I have a very simple login page which takes an ID number via a HTML form GET. What is easiest way to check that ID number against an Access DB to see if it exists? I want to redirect with the...
3
by: pingsheng | last post by:
Dear all, I have a form with dynamically created input fields. These fields go to next page for submitting into SQL database. The thing is all fields are the same but 4 fields. So each record...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.