Proxy help

how do i...

How do I deal with proxies? I havent found a way to work around them.
2,785 views 7 replies
Reply #1 Top
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.
Reply #2 Top
At one point I thought that Widgets leveraged the IE settings. Now, I'm not sure.

Posted via WinCustomize Browser/Stardock Central
Reply #3 Top
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...
Reply #4 Top
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
Reply #5 Top
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"?
Reply #6 Top
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;
Reply #7 Top
awesome I will give that a try

thanks!