INFO: ASP's Request.Form and Request.QueryString Return Objects

Last reviewed: December 11, 1997
Article ID: Q173317
The information in this article applies to:
  • Microsoft Active Server Pages, versions 1.0, 1.0b

SUMMARY

The values returned by Request.Form and Request.QueryString are actually objects, rather than strings as you would expect. This causes subtle conversion problems in server-side scripts, especially JScript.

MORE INFORMATION

The following call evaluates to TRUE:

   <% IsObject(Request.Form("Valid_Form_Value")) %>

This is due to the fact that the Request object returns an IRequestDictionary object rather than a string. In most cases, this subtle fact goes unnoticed because the scripting engine simply substitutes the "Default Value" of the object into scripts as necessary. This is what happens when you assign the requested value to a variable, as shown here:

   <% MyValue = Request.QueryString("Valid_QueryString_Value") %>

However, there are some scenarios where this subtlety causes problems. In particular, it may be necessary to perform explicit casts in JScript or when calling automation methods on objects. Another option is to use the .item syntax to extract the default value of the object. The following IsObject call evaluates to FALSE and demonstrates use of the .item syntax.

   <% IsObject (Request.QueryString("Valid_Form_Value").item) %>

REFERENCES

For the latest Knowledge Base artices and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/vinterdev/


Keywords          : AXSFJScript AXSFVBS
Technology        : kbInetDev
Version           : WINDOWS NT:1.0,1.0b
Platform          : NT WINDOWS
Issue type        : kbinfo


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.