Be Careful When Using Request Object Collections to Read a Form Variable in ASP

You can use the shorthand way to read Request object variables in ASP, like this:

sVariable = Request("txtVariable")

However, you must be careful when using it this way. The Request object has many collections, such as the QueryString collection, the Form collection, and Cookies collection. Therefore, when you use this shorthand to read a collection, it will read the QueryString collection first, then the Forms collection, and finally the Cookies collection. So you might retrieve the value of txtVariable from either the QueryString collection or Forms collection, while actually expecting it from the Cookies collection.

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


Recent Articles: