Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Mon, 21 Apr 2008 13:20:23 -0700 (PDT),    group: microsoft.public.inetsdk.programming.webbrowser_ctl        back       


Different proxy for different threads   
Good day,

I'm trying to use different proxies for different threads (a proxy per
thread), but it doesn't seem to work.
According to Microsoft KB http://support.microsoft.com/kb/226473 :
"Note INTERNET_OPTION_PROXY does not permanently change the settings.
It does this for the current process only when a NULL handle is used."

And it seems to work for different processes (I'm using
InternetSetOption with C# like this:
[code]
public void ChangeIEProxy(string strProxy)
{
            const int INTERNET_OPTION_PROXY = 38;
            const int INTERNET_OPEN_TYPE_PROXY = 3;

            Struct_INTERNET_PROXY_INFO struct_IPI;

            // Filling in structure
            struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
            struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy);
            struct_IPI.proxyBypass =
Marshal.StringToHGlobalAnsi("local");

            // Allocating memory
            IntPtr intptrStruct =
Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI));

            // Converting structure to IntPtr
            Marshal.StructureToPtr(struct_IPI, intptrStruct, true);

            bool iReturn = InternetSetOption(IntPtr.Zero,
INTERNET_OPTION_PROXY, intptrStruct, Marshal.SizeOf(struct_IPI));
}
[/code]

My question: how can I use multiple proxies with multiple threads?

Thank you.
  Mures
date: Mon, 21 Apr 2008 13:20:23 -0700 (PDT)   author:   Mures

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us