M
Mugunth
I'm trying to use a HTTPWebRequest class to retrieve a webpage. Below
is the following code....
string google = "http://www.google.com.sg/search?
hl=en&btnI=I'm+feeling+Lucky&q=";
string wikipedia = "http://en.wikipedia.org/wiki/
Special:Search?fulltext=Search&search=";
string website = wikipedia; // wikipedia does not work,
google works....
string query = textBoxUserQuery.Text;
// prepare the web page we will be asking for
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(website + query);
// execute the request
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
// we will read data via the response stream
Stream resStream = response.GetResponseStream();
Somehow, when is use google, I get a response, where as if I use
wikipedia, I get a Http Error stating
The remote server returned an error: (403) Forbidden.
The status says "System.Net.WebExceptionStatus.ProtocolError"
However I'm able to query for a page like http://en.wikipedia.org/wiki/Main_Page,
but cannot access the search page.
Am I missing something? Please help.
Mugunth
is the following code....
string google = "http://www.google.com.sg/search?
hl=en&btnI=I'm+feeling+Lucky&q=";
string wikipedia = "http://en.wikipedia.org/wiki/
Special:Search?fulltext=Search&search=";
string website = wikipedia; // wikipedia does not work,
google works....
string query = textBoxUserQuery.Text;
// prepare the web page we will be asking for
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(website + query);
// execute the request
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
// we will read data via the response stream
Stream resStream = response.GetResponseStream();
Somehow, when is use google, I get a response, where as if I use
wikipedia, I get a Http Error stating
The remote server returned an error: (403) Forbidden.
The status says "System.Net.WebExceptionStatus.ProtocolError"
However I'm able to query for a page like http://en.wikipedia.org/wiki/Main_Page,
but cannot access the search page.
Am I missing something? Please help.
Mugunth