I'm using Microsoft.XMLHTTP from a classic asp page to post info to another site...
I'd like to be able to inspect what's going on with fiddler, and to do so I have to find a way to configure Microsoft.XMLHTTP to use a proxy...
is it possible? where does Microsoft.XMLHTTP gets its configuration from?
thanks a lot
Select the Start button, then select Settings > Network & Internet > Proxy. Under Manual proxy setup, turn on Use a proxy server. Do the following: In the Address and Port boxes, enter the proxy server name or IP address and port (optional) in the respective boxes.
Set up the proxy for Local System account Open the Internet Options with this command: ? Go to “Connections” tab, click on “LAN settings”, and set up the “Proxy server” section with the relevant proxy address and port number. (optional) If you need to Bypass proxy server for local addresses, tick the relevant checkbox.
I think some things here need clearing up.
The ProgID "Microsoft.XMLHTTP" points at the same class as "MSXML2.XMLHTTP". This class uses the WinINET HTTP protocol stack that Internet Explorer uses and therefore will use whatever proxy configuration is found in the Internet Settings on the PC.
Hence for "Microsoft.XMLHTTP" the proxycfg command is not useful.
An alternative to XMLHTTP is "MSXML2.ServerXMLHTTP". This class uses the WinHTTP HTTP protocol stack which is designed to be lightweight and server friendly. It is safe to use multiple instances in multiple threads in the same process where WinINET isn't. For this reason it is ServerXMLHTTP should be used in server-side ASP code.
WinHTTP does not use the Internet Settings that WinINET uses, hence to configure the proxy that ServerXMLHTTP will use you need to use the proxycfg command. A really useful command is:-
proxycfg -u
Which copies the current WinINET proxy settings to those used by WinHTTP, if you use tools like fiddler this is useful to start monitoring traffic going through WinHTTP after fiddler is started. (Note you follow up with proxycfg -d
to remove the proxy settings).
ServerXMLHTTP also has a setProxy
method which allows the actual proxy settings to be configured dynamically be code.
For windows Vista and above, the proxycfg.exe may have been deprecated, and replaced by netsh winhttp. As mentioned in this article: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384069%28v=vs.85%29.aspx
As my situation in win7, I need to do following to set proxy:
netsh winhttp set proxy myProxyServer:80
oops
I think I found it
http://support.microsoft.com/kb/289481/EN-US/
you have to issu something like
proxycfg -d -p myProxyServer:80 "<local>"
...
edit:
I've also found that using ServerXMLHTTP instead of XMLHttp, you have a setProxy method...
http://msdn.microsoft.com/en-us/library/ms760236(VS.85).aspx
and here is a usage example
http://msdn.microsoft.com/en-us/library/ms763680(VS.85).aspx
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With