473,729 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rerouting Requests via a Proxy because of .NET "bug"

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...5BLN%5D;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 programmaticall y?

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 = ((HttpApplicati on)sender).Requ est;
HttpWebRequest wr = (HttpWebRequest )WebRequest.Cre ate(req.Url.Abs oluteUri);
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


Nov 21 '05 #1
9 3449
Codex:

One way I've worked with proxies is to use the GlobalProxySele ction
class:

GlobalProxySele ction.Select = new WebProxy("127.0 .0.1", 8888);

Hope this work for you too,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 3 Dec 2004 15:41:37 -0000, "Codex Twin" <co***@more.com >
wrote:
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.

Unfortunatel y, the .NET Framework does not support automatic proxy discovery
scripts. See:
http://support.microsoft.com/default...5BLN%5D;307220

The article above details that the way to workaround this is to edit the
machine.conf ig 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 programmaticall y?

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
OnBeginReque st method I have in my HttpModule:

public void OnBeginRequest( object sender, EventArgs e)
{
//*************** *************** *************** *************** ***********
WebProxy wp = new WebProxy("http://my.proxy.blah", true);
//*************** *************** *************** *************** ***********

HttpRequest req = ((HttpApplicati on)sender).Requ est;
HttpWebRequest wr = (HttpWebRequest )WebRequest.Cre ate(req.Url.Abs oluteUri);
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


Nov 21 '05 #2
"Codex Twin" <co***@more.com > wrote in message
news:eE******** ******@TK2MSFTN GP14.phx.gbl...
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...5BLN%5D;307220
This article has nothing to do with web forms applications. In a Web Forms
application, the browser sends a request to the server and gets an HTML
response. The browser may be configured to run an automatic proxy discovery
script and to use the discovered proxy to send to the server. The server
should neither know nor care whether one or more proxies were in the path
between the client and the server.
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
programmaticall y?


As I said, "you don't, the browser does".

Obviously something isn't working the way you expect it to, and that makes
you think that you need to do something about proxies. Please tell us what
the symptom is, and we can help you find the disease. The disease is
probably not "server-side proxy setup".

John Saunders
Nov 21 '05 #3
Thanks Scott

What I'm really stuck on is the code I need to write to route every request
to my application to this proxy.

Thanks
cT
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:15******** *************** *********@4ax.c om...
Codex:

One way I've worked with proxies is to use the GlobalProxySele ction
class:

GlobalProxySele ction.Select = new WebProxy("127.0 .0.1", 8888);

Hope this work for you too,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 3 Dec 2004 15:41:37 -0000, "Codex Twin" <co***@more.com >
wrote:
I am re-sending this in the hope that it might illicit a response. I have acorporate client who forces their workstations to get the proxy server
details using an automatic proxy discovery script.

Unfortunatel y, the .NET Framework does not support automatic proxy discoveryscripts. See:
http://support.microsoft.com/default...5BLN%5D;307220

The article above details that the way to workaround this is to edit the
machine.conf ig 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 isgood.

But in my case, I have an ASP.NET web forms app, not a Web Service. So howdo I try and route my client requests via the Proxy server programmaticall y?
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
OnBeginReque st method I have in my HttpModule:

public void OnBeginRequest( object sender, EventArgs e)
{
//*************** *************** *************** *************** *********** WebProxy wp = new WebProxy("http://my.proxy.blah", true);
//*************** *************** *************** *************** ***********
HttpRequest req = ((HttpApplicati on)sender).Requ est;
HttpWebRequest wr = (HttpWebRequest )WebRequest.Cre ate(req.Url.Abs oluteUri); wr.Proxy = wp;

}
However, this doesn't cut it. :-(
The request obviously does not get routed via the proxy server. Can Anyonetried this before and tell me how to workaround this problem.
Also, does anyone know if the .NET Framework version 2 (or even the version2 beta) addresses the problem of being able to detect proxy settings usingdiscovery scripts.
Thanks.
CT

Nov 21 '05 #4

"John Saunders" <johnwsaundersi ii at hotmail.com> wrote in message
news:OW******** ******@TK2MSFTN GP09.phx.gbl...
"Codex Twin" <co***@more.com > wrote in message
news:eE******** ******@TK2MSFTN GP14.phx.gbl...
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...5BLN%5D;307220
This article has nothing to do with web forms applications. In a Web Forms
application, the browser sends a request to the server and gets an HTML
response. The browser may be configured to run an automatic proxy

discovery script and to use the discovered proxy to send to the server. The server
should neither know nor care whether one or more proxies were in the path
between the client and the server.
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
programmaticall y?


As I said, "you don't, the browser does".

Obviously something isn't working the way you expect it to, and that makes
you think that you need to do something about proxies. Please tell us what
the symptom is, and we can help you find the disease. The disease is
probably not "server-side proxy setup".

John Saunders


John

The scenario is this: The server application I have built uses the ChartFX
(by SoftwareFX) control. This control causes the download of half a dozen or
so "client-side components". These are nothing more than .NET assemblies
which allow all the fancy dynamic chart customisation tools on the browser.
One of the conditions for the client-side dlls to work is that the client
machine has to have the .NET framework installed.

These same machines, being behind the firewall, uses the automatic proxy
discovery script to determine the proxy server settings.
Now, because of the problem detailed in the first article
(http://support.microsoft.com/default...5BLN%5D;307220) and the
fact that the .NET Framework does not support proxy discovery scripts, the
client machine cannot see get the proxy server settings and the charts fail.

When the machine.config file is amended as the article explains, then it
works. I do not have access to their machine.config files, hence the
programmatic way of supplying proxy server settings as detailed in the
second article, which as you have rightly said, only deals with Web
Services.

My problem has been where to impose this programmatic code, and what the
correct code is.

Nov 21 '05 #5
On Fri, 3 Dec 2004 16:31:02 -0000, Codex Twin wrote:
Thanks Scott

What I'm really stuck on is the code I need to write to route every request
to my application to this proxy.


If the workstation where the request is initiated is already configured to
use a proxy in their web browser then there is nothing you need to do. The
proxy will be used.
--
Tom Porterfield
Nov 21 '05 #6

"Tom Porterfield" <tp******@mvps. org> wrote in message
news:b3******** ******@tpporter mvps.org...
On Fri, 3 Dec 2004 16:31:02 -0000, Codex Twin wrote:
Thanks Scott

What I'm really stuck on is the code I need to write to route every request to my application to this proxy.
If the workstation where the request is initiated is already configured to
use a proxy in their web browser then there is nothing you need to do.

The proxy will be used.
--
Tom Porterfield

Hello Tom
Thanks for the reply.

I *want* the proxy to be used. As I have said in my post to John Saunders,
the application I have needs the .NET Framework on the client machine, and
this does not support the automatic discovery scripts to get the proxy
details. The workaround is either to amend the machine.config file or
programmatic.
My question is, what is the correct code for the programmatic solution.

Nov 21 '05 #7
"Codex Twin" <co***@more.com > wrote in message
news:Om******** ******@TK2MSFTN GP14.phx.gbl...
.... John

The scenario is this: The server application I have built uses the ChartFX
(by SoftwareFX) control. This control causes the download of half a dozen
or
so "client-side components". These are nothing more than .NET assemblies
which allow all the fancy dynamic chart customisation tools on the
browser.
One of the conditions for the client-side dlls to work is that the client
machine has to have the .NET framework installed.

These same machines, being behind the firewall, uses the automatic proxy
discovery script to determine the proxy server settings.
Now, because of the problem detailed in the first article
(http://support.microsoft.com/default...5BLN%5D;307220) and
the
fact that the .NET Framework does not support proxy discovery scripts, the
client machine cannot see get the proxy server settings and the charts
fail.
Please be more specific. Exactly what do you mean when you say "the charts
fail"?
When the machine.config file is amended as the article explains, then it
works. I do not have access to their machine.config files, hence the
programmatic way of supplying proxy server settings as detailed in the
second article, which as you have rightly said, only deals with Web
Services.

My problem has been where to impose this programmatic code, and what the
correct code is.


Whatever the solution is, it will be client-side.

Have you spoken to SoftwareFX about this? You may not be the first to have
this problem.

John Saunders
Nov 21 '05 #8

"John Saunders" <johnwsaundersi ii at hotmail.com> wrote in message
news:Od******** ********@TK2MSF TNGP10.phx.gbl. ..
"Codex Twin" <co***@more.com > wrote in message
news:Om******** ******@TK2MSFTN GP14.phx.gbl...

...
John

The scenario is this: The server application I have built uses the ChartFX (by SoftwareFX) control. This control causes the download of half a dozen or
so "client-side components". These are nothing more than .NET assemblies
which allow all the fancy dynamic chart customisation tools on the
browser.
One of the conditions for the client-side dlls to work is that the client machine has to have the .NET framework installed.

These same machines, being behind the firewall, uses the automatic proxy
discovery script to determine the proxy server settings.
Now, because of the problem detailed in the first article
(http://support.microsoft.com/default...5BLN%5D;307220) and
the
fact that the .NET Framework does not support proxy discovery scripts, the client machine cannot see get the proxy server settings and the charts
fail.


Please be more specific. Exactly what do you mean when you say "the charts
fail"?
When the machine.config file is amended as the article explains, then it
works. I do not have access to their machine.config files, hence the
programmatic way of supplying proxy server settings as detailed in the
second article, which as you have rightly said, only deals with Web
Services.

My problem has been where to impose this programmatic code, and what the
correct code is.


Whatever the solution is, it will be client-side.

Have you spoken to SoftwareFX about this? You may not be the first to have
this problem.

John Saunders

SoftwareFX have not responded (yet).
I'm halfway there, but have not been able to simulate a Request from a
ChartFX client object. So not there at all, I guess.

Thank you and have a nice weekend...

Nov 21 '05 #9
I have to agree with John. Since the calls to the server are being made
by the ChartFx controls, and you say these request are not seeing your
client configuration for proxy servers, then it is very likely that there
is no code you can add to your own application to make this work. The
exception case, and I would anticipate there to be this case, would be a
property on the chartFx controls that you can set from your client-side
load code to use a proxy.

Is there some reason that your clients need to use a proxy for internal
addresses? very often proxy settings bypass the proxy for local IP
addresses. I suppose that in some environments, the business wants to be
able to monitor every page every user goes to. <brrrrrr>

Dan Rogers
Microsoft Corporation
--------------------
From: "Codex Twin" <co***@more.com >
References: <eE************ **@TK2MSFTNGP14 .phx.gbl>
<OW************ **@TK2MSFTNGP09 .phx.gbl>
<Om************ **@TK2MSFTNGP14 .phx.gbl>
<Od************ **@TK2MSFTNGP10 .phx.gbl>
Subject: Re: Rerouting Requests via a Proxy because of .NET "bug"
Date: Fri, 3 Dec 2004 17:54:22 -0000
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <up************ **@TK2MSFTNGP11 .phx.gbl>
Newsgroups:
microsoft.publi c.dotnet.framew ork.aspnet,micr osoft.public.do tnet.framework. w
ebservices
NNTP-Posting-Host: 193.115.152.15
Path:
cpmsftngxa10.ph x.gbl!TK2MSFTNG XA01.phx.gbl!TK 2MSFTNGP08.phx. gbl!TK2MSFTNGP1 1
phx.gbl
Xref: cpmsftngxa10.ph x.gbl
microsoft.publi c.dotnet.framew ork.webservices :7804
microsoft.publi c.dotnet.framew ork.aspnet:2807 80
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.webservices
"John Saunders" <johnwsaundersi ii at hotmail.com> wrote in message
news:Od******** ********@TK2MSF TNGP10.phx.gbl. ..
"Codex Twin" <co***@more.com > wrote in message
news:Om******** ******@TK2MSFTN GP14.phx.gbl...

...
John

The scenario is this: The server application I have built uses the ChartFX (by SoftwareFX) control. This control causes the download of half a dozen or
so "client-side components". These are nothing more than .NET assemblies
which allow all the fancy dynamic chart customisation tools on the
browser.
One of the conditions for the client-side dlls to work is that the client machine has to have the .NET framework installed.

These same machines, being behind the firewall, uses the automatic proxy
discovery script to determine the proxy server settings.
Now, because of the problem detailed in the first article
(http://support.microsoft.com/default...5BLN%5D;307220) and
the
fact that the .NET Framework does not support proxy discovery scripts, the client machine cannot see get the proxy server settings and the charts
fail.


Please be more specific. Exactly what do you mean when you say "the charts
fail"?
When the machine.config file is amended as the article explains, then it
works. I do not have access to their machine.config files, hence the
programmatic way of supplying proxy server settings as detailed in the
second article, which as you have rightly said, only deals with Web
Services.

My problem has been where to impose this programmatic code, and what the
correct code is.


Whatever the solution is, it will be client-side.

Have you spoken to SoftwareFX about this? You may not be the first to have
this problem.

John Saunders

SoftwareFX have not responded (yet).
I'm halfway there, but have not been able to simulate a Request from a
ChartFX client object. So not there at all, I guess.

Thank you and have a nice weekend...


Nov 21 '05 #10

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

Similar topics

0
1302
by: mhanrahan | last post by:
Hi, I am experiencing a "bug" (maybe I am missing a setting or something) with a Windows MDI application which I am building in c# 2.0. I am doing the following: Create an MDI parent add a menustrip control Set the MDI parent form's MainMenuStrip property to be the menustrip control I have added
1
3124
by: Thomas Barnet-Lamb | last post by:
I was wondering if anyone could give me some help with the following. Consider the code snippet: struct qqq{typedef qqq* pointer;}; template<class al> struct foo : public al { template <class T> struct rebind { typedef foo<qqq> other;
0
1110
by: Dave L | last post by:
I just upgraded from VS .NET 2002 to 2003. Everything built okay, but strange bugs started appearing. Apparently there is a bug in the managed C++ compiler in regards to handling of static __events. In short, every new instance of the class clears all existing listening registered delegates. It should, of course, preserve all delegates since its static, but it does not according to this: "The real problem is the instance constructor...
2
1579
by: Philipp Schumann | last post by:
Dear all, I'm in the process of designing a distributed application on the basis of ASP.NET, which does not contain of scripts, but of assemblies containing classes that implement IHttpHandler to mimic script-like behaviour. The following section in web.config enables this particular kind of assembly usage. <httpHandlers>
0
1378
by: Ubergeek | last post by:
I noticed this bug ever since I installed VC7.1 on the same machine as VC6. Sometimes when I am working with VC6, when I do a build, after the build finishes, the various menu items/toolbars remain disabled and I cant do another build - or even quit VC. Everytime I try to quit, I am informed that I cannot Exit whilst a build is in progress, and that I have stop the build first. As I said before, the stop build button has no effect. Has...
26
2149
by: Patient Guy | last post by:
The code below shows the familiar way of restricting a function to be a method of a constructed object: function aConstructor(arg) { if (typeof(arg) == "undefined") return (null); this.property1 = arg; this.property2 = aConstantDefinedGlobally; this.method1 = function (anArg) {
8
2056
by: gw7rib | last post by:
I've been bitten twice now by the same bug, and so I thought I would draw it to people's attention to try to save others the problems I've had. The bug arises when you copy code from a destructor to use elsewhere. For example, suppose you have a class Note. This class stores some text, as a linked list of lines of text. The destructor runs as follows: Note::~Note() {
13
10391
by: Jen | last post by:
One user of my application is experiencing an exception "input string not in correct format". But it makes no sense where it is occurring. It is occurring when a string from a textbox ("172") is being convert to an Int16 (using Convert.ToInt16). How can that be? There are other text boxes that are used in the identical fashion and they don't generate the exception. All there are many other machines running my application that don't...
4
4578
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http:// www.dotnetspider.com/resources/2596-e-underlying-connection-was-closed-A-connection.aspx), it's a bug of .NET 2.0, and the author suggests that we use KeepAlive=false until Microsoft fixes it. It seems like almost 5 years have passes since the...
0
8913
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6016
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.