468,247 Members | 1,317 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

HttpWebResponse return an error: (400) Bad Request

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
1 2781
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.

Similar topics

1 post views Thread by Satinderpal Singh | last post: by
reply views Thread by hlabbott | last post: by
1 post views Thread by Satinderpal Singh | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.