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

HttpWebResponse return an error: (400) Bad Request

P: n/a
Hello all,
I'm trying to do flagging in the, firstly it works, but when I
used the WebProxy, it gave me this error:
The remote server returned an error: (400) Bad Request

This is my code :

HttpWebRequest myWebRequest = WebRequest.Create("") as

WebProxy myProxy=new WebProxy();

// Print the Proxy Url to the console.
Console.WriteLine("\nThe actual default Proxy settings are {0}",myProxy.
string proxyAddress;
proxyAddress = "";
if (proxyAddress.Length 0)
// Create a new Uri object.
Uri newUri = new Uri(proxyAddress);
// Associate the newUri object to 'myProxy' object so that new
myProxy settings can be set.
myProxy.Address = newUri;
myWebRequest.Proxy = myProxy;//when i comment this, it works

Console.WriteLine("\nThe Address of the new Proxy settings are {0}",
HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse
Console.WriteLine(new StreamReader(myWebResponse.GetResponseStream()).
catch(Exception ex)

Anybody can help me?
Thank you!!


Oct 20 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Is there anybody who can help me?

Message posted via

Oct 21 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.