Keep-alive is enabled by default in WinHTTP; there's actually no way to turn
it *off* using the WinHttpRequest script component.
What error or status code are you encountering? Can you post some sample
code, please?
Are you supplying correct username and password for the proxy server with
the SetCredentials method?
Regards,
Stephen Sulzer
Microsoft Corporation
"=nerochiaro=" <neroc...@scrauto.net> wrote in message
news:166e382e.01080...@posting.google.com...
> Hi everyone,
>
> Just a simple question:
> Is there a way to open a Keep Alive connections in WinHTTP from the
> script interface ?
>
> I am using WinHTTP inside a WSH script (JS) and i need to authenticate
> against an NTLM proxy. It appears that the only way to do this is to
> enable Keep Alive, as stated in the MSDN docs, but in the reference i
> did not find any way to do it in script (it appears that you can just
> set this option via C++ calls)
>
> Am i missing something ?
> is this by design or is this a bug or missing feature ?
>
> Thanks,
> -nero chiaro-
>
> p.s.
> I thought this as the most appropriate NG to ask a question of this
> kind, if i was wrong can someone please address me to a more
> appropriate NG ?
If the problem is the domain name issue, then you can specify it as part of
the user name paramter, like so:
WinHttpRequest.SetCredentials("domain_name\\valid_username", "valid_pwd",
HTTPREQUEST_SETCREDENTIALS_FOR_PROXY);
Also, with the current preview release of WinHttp, you need to call SetProxy
*before* the Open method, otherwise it will not take effect; this is
mentioned in the on-line documentation:
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/winht
tp/IWinHttpRequestSetProxyCpp.asp
However, this restriction should be fixed in the next beta release.
Hope that helps!
Regards,
Stephen Sulzer
Microsoft Corporation
"=nerochiaro=" <neroc...@scrauto.net> wrote in message
news:166e382e.01080...@posting.google.com...
> > The right newsgroup for WinHTTP questions is microsoft.public.winhttp
:-)
>
> Maybe it's because i'm reading/posting news via google, but i can't
> find
> any "microsoft.public.winhttp" newsgroup... o_O
>
> > Keep-alive is enabled by default in WinHTTP; there's actually no way to
turn
> > it *off* using the WinHttpRequest script component.
> >
> > What error or status code are you encountering? Can you post some sample
> > code, please?
>
> sure that i can. here's the (really simple) code i'm using:
> -------------------------------------
> var HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1;
> var HTTPREQUEST_PROXYSETTING_PROXY = 2;
>
> var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5");
>
> WinHttpReq.open("GET", "http://www.microsoft.com/", false);
>
> WinHttpReq.SetProxy( HTTPREQUEST_PROXYSETTING_PROXY,
> "myproxy.mycompany.it","intranet.mycompany.it");
>
> WinHttpReq.SetCredentials("valid_username", "valid_pwd",
> HTTPREQUEST_SETCREDENTIALS_FOR_PROXY);
>
> WinHttpReq.send();
> -------------------------------------
> of course the private info have been modified
>
> One thing that puzzles me and that i forgot to mention earlier,
> is that i get the following error message (and the script gets
> terminated) instead of just getting an 407 code in response
> from the proxy or something similar:
>
> D:\TEMP\auth.js(14, 1) WinHttp.WinHttpRequest: The login request was
> denied
>
> Out of curiosity i tried to remove the SetProxy() and SetCredentials()
> calls and i still get the same error message when calling send().
>
> > Are you supplying correct username and password for the proxy server
with
> > the SetCredentials method?
>
> Well, i am using the same credentials to access the web in IE (even
> right now) and they work well, so i guess i can be quite confident
> that they're right ;-)
> Maybe the only thing different is that IE asks me also for a domain in
> the
> auth dialog, along with the username and pwd.
> But i found no way to specify the domain in WinHTTP.
>
> Thanks for your time,
> -nero chiaro-
Unfortunately after applying both the corrections you suggested, the
situation remains unchanged.
Send() keeps raising the "login request was denied" exception, but i
have no idea why this happens.
Seems that i'm out of luck with WinHTTP... i'll take a look around to
see possible alternatives i can use in script, even though i doubt
i'll found anything useful out there that supports the damn NTLM.
Thanks for all the support so far, anyway ^__^
- nero chiaro -
Is your aync c/c++ sample available?
I very very need it.
Regards
Shelton
"Stephen Sulzer (Microsoft)" <anti-sp...@microsoft.com> wrote in message
news:ucJUZ$EIBHA.1432@tkmsftngp03...
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/winht
tp/tutorial_implement_async.asp
It requires the WinHTTP August 2001 Technology Preview Release, which is
available at:
http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/ms
dn-files/027/001/655/msdncompositedoc.xml
Regards,
Stephen Sulzer
Microsoft Corporation
"msnews" <xiao...@21cn.com> wrote in message
news:u#Pw#JYIBHA.1960@tkmsftngp05...