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 craigslist.org, 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("
http://flag.craigslist.org/?flagCode=28&postingID=884589438") as
HttpWebRequest;

WebProxy myProxy=new WebProxy();

// Print the Proxy Url to the console.
Console.WriteLine("\nThe actual default Proxy settings are {0}",myProxy.
Address);
try
{
string proxyAddress;
proxyAddress = "http://143.215.129.117:3128";
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}",
myProxy.Address);
HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse
();
Console.WriteLine(new StreamReader(myWebResponse.GetResponseStream()).
ReadToEnd());
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}

Anybody can help me?
Thank you!!

Jed

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 DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200810/1

Oct 21 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.