How to spawn IE with a proxy address

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to figure out how to create a Process that spawns IE with a
specific proxy (web-proxy:8080). Does anyone know how to do this?
 
Hi Steve,

Based on my understanding, the proxy of the IE process is shared by all
instances of it and it's stored in registry, which is changed by IE's
control panel applet.

Therefore I think unless you're hosting a web browser control in your
program, you will have to change the shared (global) settings to make
spawned IE process to use the proxy server.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
You can do this by making calls through the WinInet API (through the
P/Invoke layer). There are a number of functions in there which will allow
you to change the proxy settings for IE.
 
Thanks. I used the Registry class. It is now working. :)
--
-----------
Thanks,
Steve


Nicholas Paldino said:
You can do this by making calls through the WinInet API (through the
P/Invoke layer). There are a number of functions in there which will allow
you to change the proxy settings for IE.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

SteveT said:
I agree with you comment but how do I change the global settings
programmatically?
 
Which is exactly the wrong way to go about doing this.

You should be calling the InternetSetOption API function with an option
of INTERNET_OPTION_PROXY.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


SteveT said:
Thanks. I used the Registry class. It is now working. :)
--
-----------
Thanks,
Steve


Nicholas Paldino said:
You can do this by making calls through the WinInet API (through the
P/Invoke layer). There are a number of functions in there which will
allow
you to change the proxy settings for IE.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

SteveT said:
I agree with you comment but how do I change the global settings
programmatically?
--
-----------
Thanks,
Steve


:

Hi Steve,

Based on my understanding, the proxy of the IE process is shared by
all
instances of it and it's stored in registry, which is changed by IE's
control panel applet.

Therefore I think unless you're hosting a web browser control in your
program, you will have to change the shared (global) settings to make
spawned IE process to use the proxy server.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader
so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.
 
I agree with Nicholas here that setting the proxy via registry directly is
not the supported way, it will also requires you to restart existing IE
processes to use the new settings.

The supported way is to use InternetSetOption as following KB suggested:

#How to programmatically query and set proxy settings under Internet
Explorer
http://support.microsoft.com/kb/226473

However, I haven't found any existing managed code to do this. You may need
to use C/C++ to create wrapper DLL and call it from managed code using
P/Invoke.

Let me know if there's anything else I can help.


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top