473,378 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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.

Expand|Select|Wrap|Line Numbers
  1. public void JACCS_Response(string date,string jaccs_id,string irn,string company_id,string xmlid)
  2.        {
  3.  
  4.            string responseString = string.Empty;
  5.  
  6. // I am passing the following 4 parameters to the site.
  7.  string REQ_STR = "SEND_DATETIME=" + date + "&KAMEITEN_BANGO=" + company_id + "&JACCS_DENPYO_BANGO=" + jaccs_id + "&DENPYO_BANGO=" + irn;
  8.  
  9.            try
  10.            {
  11.                HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(ConfigurationManager.AppSettings["someurl"].ToString());
  12.  
  13. //The app.config file contains the URL to which I post the data
  14.  
  15.                webreq.Method = "POST";
  16.                //WebProxy myProxy = new WebProxy(ConfigurationManager.AppSettings["proxy"].ToString(), 80);
  17.                WebProxy myProxy = new WebProxy("someproxy");
  18.  
  19. //The proxy is specified in the app.config
  20.  
  21.                //required only for local development
  22.                myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
  23.  
  24.                //myProxy.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["ProxyUID"].ToString(), ConfigurationManager.AppSettings["ProxyPwd"].ToString(), ConfigurationManager.AppSettings["ProxyDomain"].ToString());
  25.  
  26.                webreq.Proxy = myProxy;
  27.  
  28.  
  29. //I specify the userid, password and the domain needed to access the external site
  30.  webreq.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["userid"].ToString(), ConfigurationManager.AppSettings["pwd"].ToString(), ConfigurationManager.AppSettings["domain"].ToString());
  31.  
  32.  
  33.  byte[] byteArray = Encoding.GetEncoding("shift-jis").GetBytes(REQ_STR);
  34.  
  35.                webreq.ContentLength = byteArray.Length;
  36.                webreq.ContentType = "application/x-www-form-urlencoded";
  37.  
  38.                webreq.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GoogleT5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)";
  39.  
  40.                using (Stream myStream = webreq.GetRequestStream())
  41.                {
  42.                    try
  43.                    {
  44.                        myStream.Write(byteArray, 0, byteArray.Length);
  45.                        myStream.Flush();
  46.                    }
  47.                    catch (Exception e)
  48.                    {
  49.                        throw e;
  50.                    }
  51.                }
  52.  
  53.                // Get the response.
  54.                HttpWebResponse response = (HttpWebResponse)webreq.GetResponse();
  55.  
  56.                StreamReader ResponseStream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("shift-jis"));
  57.                responseString = ResponseStream.ReadToEnd();
  58.                ResponseStream.Close();
  59.                response.Close();
  60.            }
  61.  
  62.            catch (Exception ex)
  63.            {
  64.                 throw ex;
  65.            }
  66.            }
But when I do the above, I get the error as ""The Remote server returned an error :(407) Proxy Authentication Required ".

Kindly help me out.

thanks
casukhela krishna
Nov 3 '08 #1
2 5388
debasisdas
8,127 Expert 4TB
Question moved to .NET forum.
Nov 3 '08 #2
Curtis Rutland
3,256 Expert 2GB
Please enclose your posted code in [CODE] [/CODE] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [CODE] [/CODE] tags in future.

MODERATOR
Nov 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: JezB | last post by:
I'm getting the above error thrown somewhere in the code: XPathDocument xPathDocument = new XPathDocument(FileLocation); XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();...
3
by: Paul | last post by:
Hi, This is driving me crazy. I have a solution that works great on one site, but doesn't on another site. Same exact code on two different windows environments. Here is the code: Private...
3
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...
0
by: John Bown | last post by:
This query is similar to some others on this discussion group, but none of them were resolved! Can anybody help: The issue is related to integrated authentication. First I'll describe a simple...
0
by: Malathi | last post by:
Hello, I am trying to build a Proxy class using WSDL.exe and i get this error "The request failed with HTTP status 407:Proxy authentication required" Can someone let me know what do for this?...
0
by: dan kisting | last post by:
Hello, I am writing a c# application which connects to web services through a Proxy Server. I am running a local Proxy Host to simulate what the user is seeing, and his problem is he is getting...
0
by: Learning.Net | last post by:
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...
3
by: Learning.Net | last post by:
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...
3
by: =?Utf-8?B?UmljaGFyZEBub3NwYW0ubm9zcGFt?= | last post by:
My webcam app runs OK on XP but not on Vista. Here's my code snippet that has been working up until now: System.Net.WebRequest request; System.Net.WebResponse response; request =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.