C
Codex Twin
I am re-sending this in the hope that it might illicit a response. I have a
corporate client who forces their workstations to get the proxy server
details using an automatic proxy discovery script.
Unfortunately, the .NET Framework does not support automatic proxy discovery
scripts. See:
http://support.microsoft.com/default.aspx?scid=kb;[LN];307220
The article above details that the way to workaround this is to edit the
machine.config file. This is impossible for me. Luckily there is a
programmtic way of assigning the proxy settings. The way to do it is
detailed in this article:
http://support.microsoft.com/kb/q318140/
The second article explains how to handle requests when there is a proxy
server between the .NET client and the web service. Unfortunately the
solution only deals with Web Services. The WebService class has a Proxy
property to which an object of type of IWebProxy can be passed - and all is
good.
But in my case, I have an ASP.NET web forms app, not a Web Service. So how
do I try and route my client requests via the Proxy server programmatically?
What I have tried so far is to use an HttpModule which *should* intercept
the request and route it through the Proxy server. In the custom
OnBeginRequest method I have in my HttpModule:
public void OnBeginRequest(object sender, EventArgs e)
{
//***********************************************************************
WebProxy wp = new WebProxy("http://my.proxy.blah", true);
//***********************************************************************
HttpRequest req = ((HttpApplication)sender).Request;
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(req.Url.AbsoluteUri);
wr.Proxy = wp;
}
However, this doesn't cut it. :-(
The request obviously does not get routed via the proxy server. Can Anyone
tried this before and tell me how to workaround this problem.
Also, does anyone know if the .NET Framework version 2 (or even the version
2 beta) addresses the problem of being able to detect proxy settings using
discovery scripts.
Thanks.
CT
corporate client who forces their workstations to get the proxy server
details using an automatic proxy discovery script.
Unfortunately, the .NET Framework does not support automatic proxy discovery
scripts. See:
http://support.microsoft.com/default.aspx?scid=kb;[LN];307220
The article above details that the way to workaround this is to edit the
machine.config file. This is impossible for me. Luckily there is a
programmtic way of assigning the proxy settings. The way to do it is
detailed in this article:
http://support.microsoft.com/kb/q318140/
The second article explains how to handle requests when there is a proxy
server between the .NET client and the web service. Unfortunately the
solution only deals with Web Services. The WebService class has a Proxy
property to which an object of type of IWebProxy can be passed - and all is
good.
But in my case, I have an ASP.NET web forms app, not a Web Service. So how
do I try and route my client requests via the Proxy server programmatically?
What I have tried so far is to use an HttpModule which *should* intercept
the request and route it through the Proxy server. In the custom
OnBeginRequest method I have in my HttpModule:
public void OnBeginRequest(object sender, EventArgs e)
{
//***********************************************************************
WebProxy wp = new WebProxy("http://my.proxy.blah", true);
//***********************************************************************
HttpRequest req = ((HttpApplication)sender).Request;
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(req.Url.AbsoluteUri);
wr.Proxy = wp;
}
However, this doesn't cut it. :-(
The request obviously does not get routed via the proxy server. Can Anyone
tried this before and tell me how to workaround this problem.
Also, does anyone know if the .NET Framework version 2 (or even the version
2 beta) addresses the problem of being able to detect proxy settings using
discovery scripts.
Thanks.
CT