By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

C# .NET app does not respect IE proxy settings

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.