IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

Advanced
-Collapse +Expand ASP Classic Store

Prestwood eMagazine

June Edition
Subscribe now! It's Free!
Enter your email:

   ► KBWebsite Scri...ASP ClassicLanguage Det...   Print This     
  From the November 2015 Issue of Prestwood eMag
 
ASP Classic Language Details:
Using Request.QueryString
 
Posted 16 years ago on 7/17/2007 and updated 12/29/2008
Take Away: Although you can use the generic request collection, as in Request("SomeValue"), for either Request.Form("SomeValue") or Request.QueryString("SomeValue"), it's best to avoid the generic request collection until it's really needed. Use a For Each loop to loop through elements.
 A flashcard from our ASP Classic Flashcards Library
 A tip from our ASP Classic Tips Page

KB100654

Request.QueryString("x") vs. Request("x")

Although you can use the generic request collection, as in Request("SomeValue"), for either Request.Form("SomeValue") or Request.QueryString("SomeValue"), it's best to avoid the generic request collection until it's really needed. The generic request collection causes problems in some circumstances. For example, you cannot call the generic request collection after a BinaryRead.

Looping Through Request.QueryString

Here's an example of looping through the QueryString writing out each key and value pair:

Dim Key
 
For each Key in Request.QueryString
 Response.Write Key & "=" & Request.QueryString(Key)
Next

Display First QueryString Value

The following code snippte will display the first query string value:

If Len(Request.QueryString) > 0 Then
 Response.Write "First value is " & Request.QueryString(1)
Else
 Response.Write "No query string."
End If

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P174A1
Enter key:
Tip Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100654 Counter
16715
Since 4/2/2008
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2023 Prestwood IT Solutions.   [Security & Privacy]