ServerHTTPRequest Property

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

ServerHTTPRequest Property

Specifies whether to enable (true) or disable (false) the use of the ServerHTTPRequest object in a server application. Setting the property to false causes the DOM object not to use the HTTPRequest object. Setting this property to true causes DOM documents to use ServerHTTPRequest. The default value is false.

[JScript]

JScript Syntax

domObj.setProperty(strProp, vBool);
vBool = domObj.getProperty(strProp);
[Visual Basic]

Visual Basic Syntax

domObj.setProperty(strProp, vBool)
vBool = domObj.getProperty(strProp)
[C/C++]

C/C++ Syntax

HRESULT setProperty(BSTR strProp, VARIANT vBool);
HRESULT getProperty(BSTR strProp, VARIANT* vBool);

Value

strProp
A BSTR string whose value is "ServerHTTPRequest".
vBool
A VARIANT_BOOL value of true or false. The default value is false.

Remarks

Setting this property to true means that WinHTTP.dll is used. Setting this property to false means that the WinInet component is used instead. WinHTTP is server-safe, but it lacks support for asynchronous mode and is unavailable in earlier versions of Microsoft® Windows®, such as Windows 98 and Windows Me. WinInet is widely available but unsafe in multi-thread and server environments.

In general, you must use WinHTTP with MSXML in any context where the URLMON system class (part of WinInet) is not supported or is not well supported. For example, URLMON is not supported for file download in an ASP page. Therefore, you need to set the ServerHTTPRequest property to true if you must handle XML file downloads from within an ASP page. See the document function of XSLT for more information. Also, WinHTTP is recommended in highly multi-threaded scenarios because WinHTTP handles the situation better than URLMON.

Because WinHTTP only supports synchronous loading, the async property must be set to false when the ServerHTTPRequest property is set to true.

For example:

<%@language=JScript%>
<% 
var xmldoc;
xmldoc = Server.CreateObject("Msxml2.DOMDocument.5.0");
xmldoc.async = false;
xmldoc.setProperty("ServerHTTPRequest", true);
xmldoc.load("http://myserver.com");
%>
Important   For servers running on an Intranet, the ServerHTTPRequest property requires that you run a proxycfg.exe utility to configure WinHTTP's proxy settings. They cannot be configured through the Microsoft Windows Control Panel. To download the proxy configuration utility, go to the XML Development Center's Other ResourcesWinHTTP Proxy Configuration Utility page. For instructions for running the proxycfg.exe utility, see Using the WinHTTP Proxy Configuration Utility. After you have run the proxycfg.exe tool and updated the registry, the previous registry settings cannot be restored.
Note   The ServerHTTPRequest functionality is provided by the WinHTTP APIs in the winhttp5.dll file. To function properly, the winhttp5.dll file must be in the system path, typically located in %windir%\system32.

Applies To

Component: MSXML 3.0 and later

Interface: IXMLDOMDocument2

Method: setProperty | getProperty