473,802 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

407 Proxy Authentication Required - Not using a Proxy

We have an application that is running fine on several of our customer’s
servers. However, one of our customers is having a problem running the
application. The application works on one of his Windows 2003 servers, but
not on the other one.

The application is a C++ .Net /clr Windows Service. It communicates with
our server by sending and receiving XML using the WebClient object. The
error they are receiving is “The remote server returned an error: (407) Proxy
Authentication Required”. But, our client swears that he is not going
through a proxy server.

To make things even more odd, if you reboot the server, the application
works for the first connection. The first connection can send and receive
data, but then all subsequent attempts fail with the proxy error.

The code is pretty basic:

Uri ^SourceUri = gcnew Uri(RequestUrl) ;
WebClient ^client = gcnew WebClient();
//----------create proxy server object -----------------------
NetworkCredenti al^ UserCreds = nullptr;
WebProxy^ proxyObject = nullptr;
//----------is user using a proxy-----------------------------
if (pConfig->UseProxyServ er == true){
UserCreds = gcnew NetworkCredenti al( pConfig->ProxyUserNam e,
pConfig->ProxyPasswor d, pConfig->ProxyUserDomai n );
proxyObject = gcnew WebProxy( String::Concat( "http://",
pConfig->ProxyServerNam e, ":", pConfig->ProxyServerPor t, "/") , true);
proxyObject->Credentials = UserCreds;
client->Proxy = proxyObject;
}else{
//-------------use default credentials-------------------------
client->UseDefaultCred entials = true;
}
//-------------------------------------------------------------
client->Headers->Add("Content-Type", "applicatio n/x-www-form-urlencoded;
charset=UTF-8");
array<Byte^byte Array = Encoding::UTF8->GetBytes(XmlDa taToSend);
array<Byte^resp onseArray = client->UploadData(Sou rceUri->AbsoluteUri,
"POST", byteArray);

Any ideas why the code would work the first time, but then fail with a proxy
error on subsequent attempts? Are there any tests I can run to help debug
this problem? Any help would be greatly appreciated.


Aug 14 '07 #1
1 5004
Hi Gallan,

This issue should be a System.Net.WebC lient programming problem and does
not have too much relation with C++/CLI language. Anyway, I will help you
on it.

Based on my experience, the error should be returned by the proxy server,
if the customer did not have proxy configured, this is really strange. Can
you ask the customer to check if there is any proxy setting in IE
Tools->Internet Options -Connections ->LAN settings? I suspect they may
get a proxy setting which they are unaware of.

Additionally, if they do no have proxy, why do you still explicitly pass
the proxy address and username/password through NetworkCredenti al and
WebProxy. If there is no proxy, you should specify empty proxy through
GlobalProxySele ction.GetEmptyW ebProxy method and use the
System.Net.Cred entialCache.Def aultCredentials .

Finally, if you want to understand the details of the WebClient
communications, you may enable the System.Net log tracing. In the trace
log, you may examine whether your WebClient is communicating to any proxy.
Please refer to the 2 links below to enable the trace log:
"Enabling Network Tracing"
http://msdn2.microsoft.com/en-us/library/a6sbz1dx.aspx
"How to: Configure Network Tracing"
http://msdn2.microsoft.com/en-us/library/ty48b824.aspx

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
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.
Aug 14 '07 #2

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

Similar topics

1
6402
by: Mark Ferguson | last post by:
I've been trying to get a simple pycurl script working with an authenticating proxy, here is the code (with changes to protect the guilty!): from pycurl import * import StringIO b = StringIO.StringIO() c = Curl()
4
30080
by: Morten Snedker | last post by:
I'm trying to download a file. I've tried both using webclient and the httpWebRequest. Either way it returns a "407 proxy authentication required". The program is to be run externally, so basically I don't know the users login-name, password or domain. So that makes setting the proxy in code irrelevant, doesn't it? When searching the web it appears to be a common problem. But I haven't found my solution and still can't get it to...
3
7771
by: Wild Wind | last post by:
Hello all, I apologise in advance for the long windedness of this post, but I feel that if I am going to get any solution to this problem, it is important that I present as much information that will be useful in diagnosing the problem. I have an application which calls a method of a web service that we host remotely. I have deployed the application to a
2
11434
by: rcp | last post by:
Hi all, I've read all posts from all existing threads and none of them worked to solve my problem, although its exactly the same. I'll try to explain my case and see if a kind soul could help me out: I've a win32 service in C# on a client machine A, which accesses a WS (C#) on a server machine B (hosted on an IIS) Case 1: If I try to add the WSDL for the WS through VS2005, the 'Discovery
0
2120
by: J Ames | last post by:
Please, if this is the incorrect forum for this question, let me know which forum is most appropriate. I want to make sure I get visibility with the proper gurus! I have a .NET console app that consumes an external web service. It has passed a userid and password to a web proxy object to pass through our corporate proxy server and has been running fine for weeks. Our operations staff has just changed the proxy server so that it now...
4
5997
by: Boni | last post by:
I want consuming a webserivce trough a proxy. I use this code. myService s = new myService (); System.Net.WebProxy proxyObject = new System.Net.WebProxy("http://proxyhost:8080"); s.Proxy = proxyObject; It doesn't works, it returns a error HTTP 407: Proxy Authentication Required ( Access is denied. ). But my proxy don't need a user Authentication.
7
40980
by: chandru1782 | last post by:
Dear friends, I am trying to use CPAN for installing some perl modules. i am using a ubuntu system, which has internet connection through lan and authenticated proxy. when trying to install cpan.pm , it gives the following error, can any one help, You have no /root/.cpan/sources/MIRRORED.BY I'm trying to fetch one CPAN: LWP::UserAgent loaded ok Fetching with LWP:
2
8186
by: =?Utf-8?B?TGVuc3Rlcg==?= | last post by:
A C# (.NET 2) application which uses the System.Net.HttpWebRequest object to request a resource over HTTPS is failing following the installation of a new proxy server on our internal network with 407 Proxy Authentication Required. The same request through the old proxy succeeds. The same request to an HTTP address through the new proxy succeeds. Also, the request succeeds when forced to use Basic authentication but fails on NTLM.
5
5475
by: =?Utf-8?B?TWFyaw==?= | last post by:
I'm researching what is the best way to create a generic WCF proxy wrapper that has the following requirements: 1. Remove the System.ServiceModel config section requirement for clients. We have our own configuration management that follows our application lifecycle (development/system test/production). Also, most of the proxies we build are for the middle-tier layer. 2. Create a wrapper to follow WCF Client best practices (proxy.close...
2
5427
by: krishnakrish | last post by:
Hi, My name is krishna. I am using asp.net 2.0 with C#. I amusing Windows XP professional as OS. When I post some data to an external web server I get the error as "The Remote server returned an error :(407) Proxy Authentication Required ". Here is the code I am using, Please help me out at the earliest. public void JACCS_Response(string date,string jaccs_id,string irn,string company_id,string xmlid) { string...
0
9699
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
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
9114
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 projectplanning, coding, testing, and deploymentwithout 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
7598
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
6838
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
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.