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

Accessing a web service - proxy problem

P: n/a
Jon
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a
direct connection to the internet, but on two different PCs with internet access via a proxy, I get
this exception:

System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required.
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message,
WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String methodName, Object[]
parameters)

The internet works fine on this PC with IE and Firefox. In these two browsers, a proxy is set up.
Use a proxy server for your LAN is ticked, and the address and port (80) has been entered.

Am I right in saying that my programme is not able to access the settings of the web browsers, so I
need to configure my programme with the proxy details. If so, how do I supply this information to
the proxy. Or is there a way to access the settings from IE/Firefox?
Jun 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Jon,

As for the network wroxy setting, for .NET webservice proxy class(or other
webrequest components), you can explicitly assign a webproxy(and
credentials if authentication required) to it. e.g.

=====
Webservice client = new Webservice();
client.Proxy = new WebProxy(servername, port);
=======

the following article provide a detailed example:

#Consuming a Webservice from behind a Proxy Firewall
http://www.c-sharpcorner.com/UploadF...hindproxy11212
006054829AM/webservicebehindproxy.aspx

Also, you can take full advantage of system or webbrowser proxy settings
from .NET framework 2.0. However, the detailed behavior depand on the
account under which your application is running and also the proxy setting
model(global or per user) is used on the machine. Here is a good MSDN
article mentioned details about proxy detection in .NET framework (from 11.
to 2.0)

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Jon" <.>
Subject: Accessing a web service - proxy problem
Date: Wed, 7 May 2008 17:11:35 +0100
I wrote a VS 2005 C# express programme that accesses a web service. It
works fine when there's a
direct connection to the internet, but on two different PCs with internet
access via a proxy, I get
this exception:

System.Net.WebException: The request failed with HTTP status 407: Proxy
Authentication Required.
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
Message message,
WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[]
parameters)

The internet works fine on this PC with IE and Firefox. In these two
browsers, a proxy is set up.
Use a proxy server for your LAN is ticked, and the address and port (80)
has been entered.

Am I right in saying that my programme is not able to access the settings
of the web browsers, so I
need to configure my programme with the proxy details. If so, how do I
supply this information to
the proxy. Or is there a way to access the settings from IE/Firefox?

Jun 27 '08 #2

P: n/a
Jon
Hi Steven,

Thanks very much for your help with this.

You mentioned this article "Here is a good MSDN article mentioned details about proxy detection in
..NET framework (from 11. to 2.0)" but didn't provide a link to it. Could you provide the link
please?

Thanks,

Jon
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:vs**************@TK2MSFTNGHUB02.phx.gbl...
Hi Jon,

As for the network wroxy setting, for .NET webservice proxy class(or other
webrequest components), you can explicitly assign a webproxy(and
credentials if authentication required) to it. e.g.

=====
Webservice client = new Webservice();
client.Proxy = new WebProxy(servername, port);
=======

the following article provide a detailed example:

#Consuming a Webservice from behind a Proxy Firewall
http://www.c-sharpcorner.com/UploadF...hindproxy11212
006054829AM/webservicebehindproxy.aspx

Also, you can take full advantage of system or webbrowser proxy settings
from .NET framework 2.0. However, the detailed behavior depand on the
account under which your application is running and also the proxy setting
model(global or per user) is used on the machine. Here is a good MSDN
article mentioned details about proxy detection in .NET framework (from 11.
to 2.0)

Hope this helps.

Sincerely,

Steven Cheng
From: "Jon" <.>
Subject: Accessing a web service - proxy problem
Date: Wed, 7 May 2008 17:11:35 +0100
I wrote a VS 2005 C# express programme that accesses a web service. It
works fine when there's a
direct connection to the internet, but on two different PCs with internet
access via a proxy, I get
this exception:

System.Net.WebException: The request failed with HTTP status 407: Proxy
Authentication Required.
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
Message message,
WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[]
parameters)

The internet works fine on this PC with IE and Firefox. In these two
browsers, a proxy is set up.
Use a proxy server for your LAN is ticked, and the address and port (80)
has been entered.

Am I right in saying that my programme is not able to access the settings
of the web browsers, so I
need to configure my programme with the proxy details. If so, how do I
supply this information to
the proxy. Or is there a way to access the settings from IE/Firefox?


Jun 27 '08 #3

P: n/a
Hi Jon,

Thanks for your reply.

Oops... I'm sorry for the omit. Trust me that I'm was not making joke :-).

here is the msdn reference, should be the best one which describe about the
proxy settings I've seen so far:

#Take the Burden Off Users with Automatic Configuration in .NET
http://msdn.microsoft.com/en-us/magazine/cc300743.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Jon" <.>
References: <ui**************@TK2MSFTNGP03.phx.gbl>
<vs**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: Accessing a web service - proxy problem
Date: Fri, 9 May 2008 09:43:08 +0100
Lines: 79
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Message-ID: <en**************@TK2MSFTNGP05.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: 212.2.3.58
Path: TK2MSFTNGHUB02.phx.gbl!TK2MSFTNGP01.phx.gbl!TK2MSF TNGP05.phx.gbl
microsoft.public.dotnet.framework.webservices:3525
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi Steven,

Thanks very much for your help with this.

You mentioned this article "Here is a good MSDN article mentioned details
about proxy detection in
.NET framework (from 11. to 2.0)" but didn't provide a link to it. Could
you provide the link
please?

Thanks,

Jon
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:vs**************@TK2MSFTNGHUB02.phx.gbl...
Hi Jon,

As for the network wroxy setting, for .NET webservice proxy class(or other
webrequest components), you can explicitly assign a webproxy(and
credentials if authentication required) to it. e.g.

=====
Webservice client = new Webservice();
client.Proxy = new WebProxy(servername, port);
=======

the following article provide a detailed example:

#Consuming a Webservice from behind a Proxy Firewall
http://www.c-sharpcorner.com/UploadF...hindproxy11212
006054829AM/webservicebehindproxy.aspx

Also, you can take full advantage of system or webbrowser proxy settings
from .NET framework 2.0. However, the detailed behavior depand on the
account under which your application is running and also the proxy setting
model(global or per user) is used on the machine. Here is a good MSDN
article mentioned details about proxy detection in .NET framework (from 11.
to 2.0)

Hope this helps.

Sincerely,

Steven Cheng
From: "Jon" <.>
Subject: Accessing a web service - proxy problem
Date: Wed, 7 May 2008 17:11:35 +0100
I wrote a VS 2005 C# express programme that accesses a web service. It
works fine when there's a
direct connection to the internet, but on two different PCs with internet
access via a proxy, I get
this exception:

System.Net.WebException: The request failed with HTTP status 407: Proxy
Authentication Required.
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
Message message,
WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[]
parameters)

The internet works fine on this PC with IE and Firefox. In these two
browsers, a proxy is set up.
Use a proxy server for your LAN is ticked, and the address and port (80)
has been entered.

Am I right in saying that my programme is not able to access the settings
of the web browsers, so I
need to configure my programme with the proxy details. If so, how do I
supply this information to
the proxy. Or is there a way to access the settings from IE/Firefox?

Jun 27 '08 #4

P: n/a
Hi Jon,

Have you resolved the issue? Or does the article I posted in last message
help you some?

If you have any further questions, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

--------------------
From: st*****@online.microsoft.com (Steven Cheng [MSFT])
Organization: Microsoft
Date: Fri, 09 May 2008 10:08:31 GMT
Subject: Re: Accessing a web service - proxy problem

Hi Jon,

Thanks for your reply.

Oops... I'm sorry for the omit. Trust me that I'm was not making joke :-).

here is the msdn reference, should be the best one which describe about the
proxy settings I've seen so far:

#Take the Burden Off Users with Automatic Configuration in .NET
http://msdn.microsoft.com/en-us/magazine/cc300743.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Am I right in saying that my programme is not able to access the settings
of the web browsers, so I
need to configure my programme with the proxy details. If so, how do I
supply this information to
the proxy. Or is there a way to access the settings from IE/Firefox?



Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.