Ошибка HttpWebRequest :503 сервер недоступен

Я использую HttpWebRequest и я получаю сообщение об ошибке при выполнении GetResponse ().

Я использую этот код:

private void button1_Click(object sender, EventArgs e)
    {
        Uri myUri = new Uri("http://www.google.com/sorry/?continue=http://www.google.com/search%3Fq%3Dyamaha");
        // Create a 'HttpWebRequest' object for the specified url. 
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myUri);
        // Set the user agent as if we were a web browser
        myHttpWebRequest.UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4";

        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
        var stream = myHttpWebResponse.GetResponseStream();
        var reader = new StreamReader(stream);
        var html = reader.ReadToEnd();
        // Release resources of response object.
        myHttpWebResponse.Close();

        textBox1.Text = html;
    }
6
задан Jeff LaFay 11 April 2012 в 13:51
поделиться