मैं HttpWebRequest का उपयोग कर रहा हूं और GetResponse() निष्पादित करते समय मुझे त्रुटि मिलती है।HttpWebRequest त्रुटि: 503 सर्वर अनुपलब्ध
मैं इस कोड का उपयोग:
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;
}
आप एक ही त्रुटि मिली थी जब एक ब्राउज़र में URL या कर्ल जैसे किसी उपकरण का अनुरोध? – jlafay
यह प्रोग्रामेटिक रूप से लाने के लिए एक निश्चित रूप से अजीब यूआरएल जैसा दिखता है। इसके लिए कोई कारण? –
http://www.google.com/sorry/ 503 देता है। यदि आप Google को बड़ी संख्या में प्रश्न स्वचालित करने की कोशिश कर रहे हैं, तो आपको वह यूआरएल मिल सकता है। लेकिन जैसा कि जॉन स्कीट ने पूछा, आप उस यूआरएल को पहले स्थान पर क्यों सबमिट कर रहे हैं? Http://support.google.com/websearch/bin/answer.py?hl=hi&answer=86640 –