472,789 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

C# .NET app does not respect IE proxy settings

posting this again as : rg******@newsgroup.nospam

We have a C# .NET app which runs as a service.
It posts data to a server using HttpWebrequest.
According to the docs I 've read, it should use the proxy settings from IE
on the server machine. But it doesn't, it always posts straight to the
server.
I tried forcing it by doing this:

WebProxy defaultProxy = WebProxy.GetDefaultProxy();
webRequest.Proxy = defaultProxy;

But that doesn't seem to make it use the proxy settings either.
On the flip side, a client I have which calls webservices DOES respect the
proxy settings without my ever telling it to do so.
How do I get the HttpWebRequest to respect the IE proxy settings?

thanks
Robb

Jul 21 '05 #1
3 7390
Hi Robb,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get the default IE proxy
setting. If there is any misunderstanding, please feel free to let me know.

I tried your code on my machine, it works fine. WebProxy.GetDefaultProxy()
can get the IE proxy setting properly.

However, according to the document, the GetDefaultProxy method reads the
nondynamic proxy settings stored by Internet Explorer 5.5 and creates a
WebProxy instance with those settings. The GetDefaultProxy does not pick up
any dynamic settings that are generated from script run by Internet
Explorer, from automatic configuration entries, or from DHCP or DNS lookups.

So could you please check the version of IE to see if it is higher than 5.5
and if the proxy setting is an automatic one?

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #2
I'm not positive, but the proxy settings may be stored for each user,
and not for the entire computer.

Try running your code in an interactive application (console or
winforms) and see if it picks up the proxy settings correctly.

It could be that when your application runs as a service, it runs under
a specific account which does not have the proxy settings configured or
loaded.

Robb Gilmore wrote:
posting this again as : rg******@newsgroup.nospam

We have a C# .NET app which runs as a service.
It posts data to a server using HttpWebrequest.
According to the docs I 've read, it should use the proxy settings from IE
on the server machine. But it doesn't, it always posts straight to the
server.
I tried forcing it by doing this:

WebProxy defaultProxy = WebProxy.GetDefaultProxy();
webRequest.Proxy = defaultProxy;

But that doesn't seem to make it use the proxy settings either.
On the flip side, a client I have which calls webservices DOES respect the
proxy settings without my ever telling it to do so.
How do I get the HttpWebRequest to respect the IE proxy settings?

thanks
Robb

Jul 21 '05 #3
Thanks for Joshua's response.

Hi Robb,

I'm sorry that I didn't read your post clearly, since you're developing a
windows service. The proxy setting is user specific just as Joshua
mentioned. In a local system account, we cannot get the proxy setting for a
certain user.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dan | last post by:
I have an app that communicates over the Internet through API calls to the wininet DLL. I can determine whether IE has a proxy server configured (not the setting, just whether it uses a proxy...
0
by: Fuzzyman | last post by:
I'm trying to create a proxy server - one that will modify requests made through it. I've started with Tiny HTTP Proxy by SUZUKI Hisao which is built on BaseHTTPServer - and I'm starting to get...
0
by: Carl Waldbieser | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** When using urllib2.urlopen() on my Windows 2000 machine at work, I was puzzled that I kept getting back authentication errors from...
3
by: Robb Gilmore | last post by:
posting this again as : rgilmore@newsgroup.nospam We have a C# .NET app which runs as a service. It posts data to a server using HttpWebrequest. According to the docs I 've read, it should use...
1
by: Robb Gilmore | last post by:
Posting this again as: rgilmore@newsgroup.nospam (Also posted under dotnet.general) We have a C# .NET app which runs as a service. It posts data to a server using HttpWebrequest. According to...
1
by: dlutz | last post by:
Hello to all -- I am familiar with Xml in general and NET 1.1 Xml, but I am new to the ..NET 2.0 changes in System.Xml. I am trying to validate an XML document that is based on a schema that...
0
by: Maxx57 | last post by:
C# VS.Net 1.1 (2003) - trouble with using IE proxy server settings I've got a program that detects if it can connect to a webservice. It sends a System.Net.WebRequest and then checks the...
1
by: OlaPihl | last post by:
Hi, How can I by code enable and disable "Bypass proxy server for local adresses" in Internet Explorer / Tools / Internet Options / Connections / LAN Settings. I have made a program (VB.Net)...
4
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.