471,336 Members | 1,263 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 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 7190
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Fuzzyman | last post: by
reply views Thread by Carl Waldbieser | last post: by
3 posts views Thread by Robb Gilmore | last post: by
1 post views Thread by OlaPihl | last post: by
reply views Thread by rosydwin | last post: by

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.