Convert Form Collection into a String

You can convert the entire Request.Form collection into a single string variable just by referencing the collection without specifying the key or index.

The format of the string would look like as follows:


Basically the string would contain all the name/value pairs where each name/value pair is separated from the others with an ampersand (&) character. This is useful if you want to cache the entire collection in some hidden field for future processing.

If you have following form declaration in your ASP page:

Work Phone:Home Phone:

Then this code would convert the Form collection into a string variable when the user clicked on the submit button.

 <%Dim strFormCollection' this call will convert the entire collection ' into a string.strFormCollection = Request.Form' format of strFormCollection would look like' WorkPhone=111222333&HomePhone=444555666%>

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: