Proxy help

how do i...

Monday, March 27, 2006 by Kevison | Discussion: DesktopX

How do I deal with proxies? I havent found a way to work around them.
Kevin_C
Reply #1 Monday, March 27, 2006 8:47 AM
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.
ZubaZ
Reply #2 Monday, March 27, 2006 9:39 AM
At one point I thought that Widgets leveraged the IE settings. Now, I'm not sure.

Posted via WinCustomize Browser/Stardock Central
Kevison
Reply #3 Tuesday, March 28, 2006 9:12 AM
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...
Kevin_C
Reply #4 Tuesday, March 28, 2006 1:02 PM
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
RomanDA
Reply #5 Wednesday, March 29, 2006 7:37 AM
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"?
Kevin_C
Reply #6 Wednesday, March 29, 2006 9:46 AM
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;
Kevison
Reply #7 Wednesday, March 29, 2006 11:09 AM
awesome I will give that a try

thanks!

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01