I guess you can also configure this by changing the machine.config file:
<system.net>
.
<defaultProxy>
<proxy usesystemdefault="false" />
.
</defaultProxy>
</system.net>
Cheers,
Yuri Misnik
MCP, MCSD, MCAD.NET
-----Original Message-----
From: xiao [mailto:[EMAIL PROTECTED]]
Sent: Monday, 20 January 2003 04:43
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Bypass http proxy server for intranet app
using remoting
I found out how to fix this, I just need to add the following two lines
of
code after obtaining the remote object,
HttpChannel theChannel = (HttpChannel)
ChannelServices.GetChannel("http");
theChannel.Properties["proxyName"] = null;
This tells the httpchannel not to go through a proxy server.
If you are interested, here is how i find it out.
After digging into the source code of HttpClientChannel, i found that it
used a WebProxy object to access any http resources. Here is how the
proxy
settings are obtained,
WebProxy defaultProxy = WebProxy.GetDefaultProxy();
if (defaultProxy != null)
{
Uri address = defaultProxy.Address;
if (address != null)
{
_proxyName = address.Host;
_proxyPort = address.Port;
}
}
UpdateProxy();
..
..
private void UpdateProxy()
{
if ((_proxyName != null) && (_proxyName.Length > 0)
&&
(_proxyPort > 0))
{
WebProxy proxy = new WebProxy(_proxyName, _proxyPort);
proxy.BypassProxyOnLocal = true;
String[] bypassList = new String[]{ CoreChannel.GetMachineIp
() };
proxy.BypassList = bypassList;
_proxyObject = proxy;
}
else
{
_proxyObject = new WebProxy();
}
}
Notice that, during this process, the GetDefaultProxy method reads the
nondynamic proxy settings stored by Internet Explorer 5.5 and create a
new
WebProxy object with that settings in the first place. But then the
UpdateProxy() method creates a new proxy based on that only keeping the
basic information but NOT including the BypassList.
This is why enabling/diabling proxy server from the IE->Tools-
>InternetOptions->Connections affects my application, but the bypass
list
on the Advanced dialog does NOT!!!
When reset the proxyName property to null, the UpdateProxy() method is
invoked again - this time creates a blank WebProxy() - allowing me to
bypass the proxy server from my client application.
Whew...
xiao
You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.