次の方法で共有


IRequestDictionary::get_Item

The IRequestDictionary::get_Item method retrieves the specified item from a Request Object object dictionary.

HRESULT get_Item(
      VARIANT Var,
      VARIANT* pVariantReturn
);

Parameters

  • Var
    [in] Contains the name of the item in the collection.

  • pVariantReturn
    [retval] [out] Points to a VARIANT that receives the item value.

Remarks

Automation objects can specify that one or more VARIANT parameters are optional. This is done by passing the parameter with the type set to VT_ERROR and a value of DISP_E_PARAMNOTFOUND. For example, if you want to do this with the Var parameter, the value it returns will depend on the object's implementation of the IRequestDictionary interface. The QueryString object would then return the entire query string.

  • For Request.QueryString, pVariantReturn contains the unparsed query string data.

  • For Request.Form, pVariantReturn contains the unparsed form data.

  • For Request.Cookies, pVariantReturn contains a URL-encoded list of the cookies.

  • For Request.ClientCertificate, pVariantReturn contains a URL-encoded list of the items in the certificate.

  • Request.ServerVariables and Response.Cookies do not accept an optional VARIANT parameter, and will raise a COM Automation exception if Var is DISP_E_PARAMNOTFOUND.

If Var is not an optional parameter then it must be a VT_BSTR or a VT_DISPATCH pointer with a default value that can be converted to a BSTR. In this case, the BSTR value of Var is looked up in the appropriate dictionary, and the value of Var is returned. If Var is not in the dictionary, then a VARIANT equal to VT_EMPTY is returned if the IRequestDictionary is covering one of the Request object's collections. If the IRequestDictionary pointer is the Response.Cookies collection, a new cookie with the name of Var is created, and that cookie is returned. If Var is not a BSTR (and not DISP_E_PARAMNOTFOUND), then the get_Item method will raise an OLE Automation exception.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also