Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

Initializes an MSXML2.XMLHTTP request and specifies the method, URL, and authentication information for the request.

Script Syntax

Copy Code
oXMLHttpRequest.open(
bstrMethod, 
bstrUrl, 
varAsync, 
bstrUser, 
bstrPassword);

Remarks

Script Parameters

bstrMethod

String. HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND.

bstrUrl

String. Requested URL. This must be an absolute URL, such as "http://Myserver/Mypath/Myfile.asp".

varAsync

[optional] Boolean. Indicator of whether the call is asynchronous. The default is True(the call returns immediately). If set to True, attach an onreadystatechange Property (IXMLHTTPRequest)callback so that you can tell when the sendcall has completed.

bstrUser

[optional] Name of the user for authentication. If this parameter is Null ( "") or missing and the site requires authentication, the component displays a logon window.

bstrPassword

[optional] Password for authentication. This parameter is ignored if the user parameter is Null ( "") or missing.

Script Return Value

None.

C/C++ Syntax

Copy Code
HRESULT open(
  BSTR 
bstrMethod, 
  BSTR 
bstrUrl, 
  VARIANT 
varAsync,
  VARIANT 
bstrUser, 
  VARIANT 
bstrPassword
);

Remarks

C/C++ Parameters

bstrMethod

[in] HTTP method used to open the connection, such as PUT or PROPFIND.

bstrUrl

[in] Requested URL. This must be an absolute URL, such as "http://Myserver/Mypath/Myfile.asp".

varAsync

[in, optional] Boolean. Indicator as to whether the call is asynchronous. The default is True(the call returns immediately). If set to True, attach an onreadystatechange Property (IXMLHTTPRequest)callback so that you can tell when the sendcall has completed.

bstrUser

[in, optional] Name of the user for authentication. If this parameter is Null ( "") or missing and the site requires authentication, the component displays a logon window.

bstrPassword

[in, optional] Password for authentication. This parameter is ignored if the user parameter is Null or missing.

C/C++ Return Values

S_OK

Value returned if successful.

E_FAIL

Value returned if an error occurs.

E_INVALIDARG

Value returned if bstrUrlor bstrMethodare NULL

E_OUTOFMEMORY

Value returned if bstrMethod is unable to open connection.

E_ACCESSDENIED

Value returned if bstrPassword is invalid.

Requirements

Header msxml2.h, msxml2.idl
Library uuid.lib
Windows Embedded CE Windows CE .NET 4.0 and later

General Remarks

The values of the request headers, request body, response headers, and response body must be cleared before calling this method.

After calling this method, you must call sendto send the request and data, if any, to the server.

This method applies to the following interface:

IXMLHTTPRequest

See Also