views:

1376

answers:

2

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

A: 

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

...

opensas
+5  A: 

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.

AnthonyWJones
thanks a lot, very useful answer! (I see where your 16k reputation comes from...)I tried using ServerXMLHTTP wiht proxycfg -u and it worked like a charm...thanks a lot (but I still wonder why with XMLHTTP I doesn't work...)
opensas