how do i...
Published on March 27, 2006 By Kevison In DesktopX
How do I deal with proxies? I havent found a way to work around them.
Comments
on Mar 27, 2006
For what? creating widget? Using widgets? If it's the latter the widget would have to be coded to support connections through a proxy server.
on Mar 27, 2006
At one point I thought that Widgets leveraged the IE settings. Now, I'm not sure.

Posted via WinCustomize Browser/Stardock Central
on Mar 28, 2006
Sorry yes I ment through widgets. I thought they leveraged the IE settings too but doesnt seem to be true in my case. I tried making OD objects but they didnt work either behind a proxy.

Are there any sample code to show this coding? My own attempts for whatever reason do not seem to work. Kind of wished I hadnt trashed the objects...
on Mar 28, 2006
Here's a snippet of how to make HTTP requests using a proxy

var winHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

PROXY_SERVER = document.all.serverName.value + ":" + document.all.serverPort.value;
winHttpReq.SetProxy(HTTPREQUEST_PROXYSETTING_PROXY, PROXY_SERVER, "");

winHttpReq.Open("GET", "https://www.someplace.com", false);
winHttpReq.SetRequestHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)");
winHttpReq.Send();

This will submit a request to the server and the results can be displayed through calling

winHttpReq.ResponseText
on Mar 29, 2006
Does that work if there is no proxy? Meaning if i make a gadget and some people have a proxy and some don't will it work for both? or do i need something in the pref's to say "use proxy"?
on Mar 29, 2006
or do i need something in the pref's to say "use proxy"


You would need something that allowed your users to choose whether or not to use a proxy because they would need to enter the proxy server name and port.

Oh, and since I forgot to post this with the original code, you'll need some of these and you can get the description for them at MS's MSDN site.

// HttpRequest SetCredentials flags.
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0;
HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1;

HTTPREQUEST_PROXYSETTING_DEFAULT = 0;
HTTPREQUEST_PROXYSETTING_PRECONFIG = 0;
HTTPREQUEST_PROXYSETTING_DIRECT = 1;
HTTPREQUEST_PROXYSETTING_PROXY = 2;
on Mar 29, 2006
awesome I will give that a try

thanks!