HttpWebResponse return an error: (400) Bad Request

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jedliu

    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.Crea te("
    http://flag.craigslist .org/?flagCode=28&po stingID=8845894 38") as
    HttpWebRequest;

    WebProxy myProxy=new WebProxy();

    // Print the Proxy Url to the console.
    Console.WriteLi ne("\nThe actual default Proxy settings are {0}",myProxy.
    Address);
    try
    {
    string proxyAddress;
    proxyAddress = "http://143.215.129.117 :3128";
    if (proxyAddress.L ength 0)
    {
    // Create a new Uri object.
    Uri newUri = new Uri(proxyAddres s);
    // Associate the newUri object to 'myProxy' object so that new
    myProxy settings can be set.
    myProxy.Address = newUri;
    myWebRequest.Pr oxy = myProxy;//when i comment this, it works
    }

    Console.WriteLi ne("\nThe Address of the new Proxy settings are {0}",
    myProxy.Address );
    HttpWebResponse myWebResponse = (HttpWebRespons e)myWebRequest. GetResponse
    ();
    Console.WriteLi ne(new StreamReader(my WebResponse.Get ResponseStream( )).
    ReadToEnd());
    }
    catch(Exception ex)
    {
    Console.WriteLi ne(ex.Message);
    }

    Anybody can help me?
    Thank you!!

    Jed

  • jedliu via DotNetMonster.com

    #2
    Re: HttpWebResponse return an error: (400) Bad Request

    Is there anybody who can help me?

    --
    Message posted via DotNetMonster.c om
    Best online pokies for real money in Australia and learn about safety and game mechanics in this comprehensive guide.


    Comment

    Working...