473,606 Members | 2,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"The Remote server returned an error :(407) Proxy Authentication Required "

Hi All,
I have an windows application created in C# &it is running fine on
several of our customer.
It does a httpWebrequest in the background.
Everything was working fine but some customer are facing
"The Remote server returned an error :(407) Proxy Authentication
Required "
{
WebRequest request = WebRequest.Crea te("http://TServer.com/
WebForm2.aspx") ;
string Text = "Question";
request.Method = "POST";
string postData = "TextBox1="+Tex t;
byte[] byteArray = Encoding.UTF8.G etBytes(postDat a);
request.Content Type = "applicatio n/x-www-form-urlencoded";
request.Content Length = byteArray.Lengt h;
Stream dataStream = request.GetRequ estStream();
dataStream.Writ e(byteArray, 0, byteArray.Lengt h);
dataStream.Clos e();
WebResponse response = request.GetResp onse();
Console.WriteLi ne(((HttpWebRes ponse)response) .StatusDescript ion);
dataStream = response.GetRes ponseStream();
StreamReader reader = new StreamReader(da taStream);
string responseFromSer ver = reader.ReadToEn d();
Console.WriteLi ne(responseFrom Server);
reader.Close();
dataStream.Clos e();
response.Close( );
}

Please Help me out!!

Oct 31 '07 #1
3 25801
On Oct 31, 6:37 am, "Learning.N et" <sanjay.btech2. ..@gmail.comwro te:
I have an windows application created in C# &it is running fine on
several of our customer.
It does a httpWebrequest in the background.
Everything was working fine but some customer are facing
"The Remote server returned an error :(407) Proxy Authentication
Required "
Well, the first thing that's wrong with the code is that it can leak
connections etc if an exception is thrown. Use "using" blocks for
everything that implements IDisposable, such as Stream and
WebResponse.

However, that's not the cause of the issue. The cause is fairly well
described by the exception - you'll need to set a proxy for the web
request (set WebRequest.Prox y), specifying appropriate authentication.
You'll probably need to provide some way of the user configuring this.

Jon

Oct 31 '07 #2
On Oct 31, 1:18 pm, "Jon Skeet [C# MVP]" <sk...@pobox.co mwrote:
On Oct 31, 6:37 am, "Learning.N et" <sanjay.btech2. ..@gmail.comwro te:
I have an windows application created in C# &it is running fine on
several of our customer.
It does a httpWebrequest in the background.
Everything was working fine but some customer are facing
"The Remote server returned an error :(407) Proxy Authentication
Required "

Well, the first thing that's wrong with the code is that it can leak
connections etc if an exception is thrown. Use "using" blocks for
everything that implements IDisposable, such as Stream and
WebResponse.

However, that's not the cause of the issue. The cause is fairly well
described by the exception - you'll need to set a proxy for the web
request (set WebRequest.Prox y), specifying appropriate authentication.
You'll probably need to provide some way of the user configuring this.

Jon
Thanks for the help!!
How user can configure the proxy ? Please help me with some code
snippet.

Nov 5 '07 #3
On Nov 5, 9:32 am, "Learning.N et" <sanjay.btech2. ..@gmail.comwro te:
However, that's not the cause of the issue. The cause is fairly well
described by the exception - you'll need to set a proxy for the web
request (set WebRequest.Prox y), specifying appropriate authentication.
You'll probably need to provide some way of the user configuring this.

Thanks for the help!!
How user can configure the proxy ? Please help me with some code
snippet.
The easiest thing would be for them to configure their system proxy
through IE appropriately - then I *believe* it should just work by
default.

Otherwise, you'll need to provide some configuration user interface,
and then build a WebProxy instance based on that.

Jon

Nov 5 '07 #4

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

Similar topics

1
9085
by: Tomas Christiansen | last post by:
Im trying to make a simple TCP socket "relay" or "proxy", but my skills in Python are not high (yet). The only thing it should do, is to open the connection on behalf of the client, and when the client closes the connection, it should do so too. It's going to "relay" PCL and/or PostScript printjobs to a TCP/IP printer. Does anyone have some sugggestions on code-examples? I've tried googling around, but couldn'r find anythin usefull.
3
24945
by: Alan Howard | last post by:
Hi there, I can't seem to find any info on this error message that's generated when sending email with CDO: "The pickup directory path is required and was not specified" Does anyone know whether the cdoSMTPServerPickupDirectory field of the Message object defaults and whether it's normal to have to set this value explicitly. My W2K workstations and servers function OK without this
1
2962
by: Angel | last post by:
I'm trying to connect to a fixed IP address (eg. http://10.60.903.50/TempFile) in order to retrieve one accii line of text in TempFile. I try to read the information with this code: string fullpath = " http://10.60.93.51/TempFile "; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(fullpath); //req.KeepAlive = false; HttpWebResponse res; StreamReader sr; string strResult = "";
0
1246
by: thatrickguy | last post by:
Hi everyone. I am developing on a Windows XP sp2 machine with VS.Net 2002 installed. Windows firewall is disabled. I have a Windows 2k Server sp4 with IIS 5 and VS.Net 2002 installed. (testsrv01) The two machines are on the same subnet and domain, and there is no firewall or proxy between them.
0
2615
by: lpinho | last post by:
Hi There, I've generated a C# file from a wsdl file using wsdl.exe utility. Then I created a console application and made a call to the method generated, first I got the error: "The request failed with HTTP status 407: Proxy Access Denied." Then I added a proxy validating and proxy credentials and got this:
0
5685
by: jens Jensen | last post by:
Hello, I'm trying to connect to a system via https. As an additional security measure, the server requires me to attach an x509 certs to my "HTTP POST" request. I get the error described in the subject.
0
4391
by: serge | last post by:
I have 2 SQL Enterprise Editions running SP2 and same collation. When i try to start database mirroring I get the following error message: "The remote copy of database "ABC" has not been rolled forward to a point in time that is emcompassed in the local copy of the database log. (Microsoft SQL Server, Error: 1412)" Both SQL Server services are running under account
0
1886
by: =?Utf-8?B?R2VvcmdlIFNodWk=?= | last post by:
I have a folder structure such like this. A ---A1 -----a1.aspx ---A2 A1 and A2 are the subfolder of A. And under the A1 folder, it contains one aspx file named a1.aspx. I set the IIS virtual dictionary to A folder. And IIS has allowed annoymous access. But when I use following code to access the webpage and I got the error" The
0
2566
by: Brian Lampe | last post by:
On Apr 11, 7:25 am, subhash <chend...@hotmail.comwrote: If your service is using a port other than 80, you can specify it in the service instantiation's Url property: http://msdn2.microsoft.com/en-us/library/ms153652.aspx From this example, ReportingService2005 rs = new ReportingService2005();
0
7955
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
8431
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
8096
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
8306
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
6773
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...
0
5466
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
3937
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...
0
3980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1557
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.