Solved

Passing an array to an active server page

Posted on 1998-07-24
1
188 Views
Last Modified: 2013-12-25
Is it possible to pass an array to an active server page, using
the post method, as in
URL?array=array_name(5)&size_of_array=5

or in some simialr way.
I have to pass about 20 values to the asp.
      If it is not possible to pass an array would
it be O.K. to pass them as single arguments, i.e.
having 20 vaules listed after the URL.
      Is there any other way to achieve this goal.
Thanks in advance
0
Comment
Question by:martythegreat
1 Comment
 
LVL 4

Accepted Solution

by:
mitek earned 100 total points
ID: 1831148
Of course, it's possible. The specs were designed in such a way so that to allow passing multiple arguments with the same name via GET or POST methods.

The idea is to do something like:

script.asp?array_name=5&array_name=8&array_name=some_text&array_name=abc&other_array=5&other_array=10 ... etc.

and the like. If there are duplicate names in the get (post data) string, they will be treated as an array. This way one can pass several arrays to an asp script.

The good news is that it keeps the order of values, too ! In one application, I actually was passing two arrays of values (along with several standalone vars) using the method described above -- one array of value ids, and the other one -- of values (to be inserted into a database). And they ALWAYS matched -- meaning, they translated into array exactly in the order they apperad in GET (POST) string

In ASP, if it's VBScript, just treat the
Request.Query("array_name") as an array.

Of course, it's possible also to pass array in single variable, following certain naming convention, if you know in advance how many values you'll have. Like,
script.asp?array_name1=5&array_name2=8&array_name3=some_text&array_name4=abc&other_array1=5&other_array2=10 ...

but it's much more limiting -- using the first method, you don't need to know the array size.
 
BTW, POST and GET methods use pretty much the same conventions about passing arguments.









0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now