Converting a collection to a JScript object in ASP

Enumerators are collections of data that can be iterated through. Although useful, they are not compliant with ECMAScript standards, and therefore I prefer not to use them. Some objects in the ASP environment however, such as Request.Form, are provided as Enumerators, and need to be converted them to standard JScript objects. Here’s a couple of routines to do so.

Converting A Collection To A Plain JScript Object Conversion Functions In Classic ASP.

I keep all the functions below in a generic include, coll2obj.asp, and use it across projects. This is a generic collection-to-object conversion, which doesn’t seem to work on some built-in collections.

Converting Request.ServerVariables To JScript Object In Classic ASP.

I’m not quite sure why the function above won’t work on Request.ServerVariables, but it doesn’t, so here’s a function for that specific collection.

Converting Post Variables To JScript Object In Classic ASP.

The same holds for post variables…

Converting Post Variables To JScript Object In Classic ASP.

…and query string variables.

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>